
举个例子:
#coding:utf-8
s = u'中文'
f = open("test.txt","w")
f.write(s)
f.close()
原因是编码方式错误,应该改为utf-8编码。
解决方案一:
#coding:utf-8
s = u'中文'
f = open("test.txt","w")
f.write(s.encode("utf-8"))
f.close()
解决方案二:
#coding:utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
s = u'中文'
f = open("test.txt","w")
f.write(s)
f.close()







![# [0622] Task02 model-free 免模型类 RL 算法的预测和控制 【ε 贪心策略 优化的证明】](https://img-blog.csdnimg.cn/direct/389f4b20c577437596921a377e904043.png)










