import sys
reload(sys)
sys.setdefaultencoding("utf-8")
我用的python2.7 eclipse-pydev,这上面第三行设置编码老是提示错误!不知道怎么回事。如下图第7行,前面这个红X,下面一条红线,意思就是说这行代码有错。
高洛峰2017-04-18 10:22:19
You have to report the error. What is the error? It will be difficult for others to know where you went wrong.
怪我咯2017-04-18 10:22:19
Create a screenshot or copy the error code to see?
Try sys.setdefaultencoding after import sys
import sys
sys.setdefaultencoding("utf-8")
reload(sys)