解决UnicodeEncodeError: 'ascii' codec can't encode c

将字符串写入文本时出现解决UnicodeEncodeError: 'ascii' codec can't encode characters in position
解决办法:
在开头加上
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )


本文转自 IT阿飞 51CTO博客,原文链接:http://blog.51cto.com/itafei/2072403
点赞