Python中open()函数写和读中文处理 写入文件时: fp.write(u"中文".encode(’‘utf-8’’)),中文前加u;读文件时:循环出的结果需解码用:f.decode(“utf-8”) import os def readfile(filename): fp = open(filename,'rb') for f in fp: print(