python读写文件时中文的转码问题时间:2023-03-09 00:28:38 读写文件都要将中文转为unicode字符。 读文件: u = unicode(s, 'gbk') 这里不能使用encode 写文件: u = encode('utf')