标签: f.write

后浪云Python教程:python f.write中文乱码怎么解决

举个例子: #coding:utf-8 s = u'中文' f = open("test.txt","w") f.write(s) f.close() 原因是编码方式错误,应该改为utf-8编码。 相关……