解决办法:
# -*- coding: utf-8 -*- import codecs content = u'你好 你是最好的!helloworld' f =codecs.open(path,mode="w",encoding="utf-8") f.write(content) f.close()
# -*- coding: utf-8 -*- import codecs content = u'你好 你是最好的!helloworld' f =codecs.open(path,mode="w",encoding="utf-8") f.write(content) f.close()