由__future__中unicode_literals引发的错误来研究python中的编码问题

在py2.7的项目中用了__future__模块中的 unicode_literals 来为兼容py3.x作准备,今天遇到一个UnicodeEncodeError的错误,跟了下,发现这个小坑值得注意。是怎么样的一个坑呢?跟着代码看看。顺便深究一下原理。html 1. 未引入unicode_literals版本 #coding:utf-8 from datetime import datetime
相关文章
相关标签/搜索