python 输出乱码

在Python中有两种默认的字符串:str和unicode。在Python中一定要注意区分“Unicode字符串”和“unicode对象”的区别。后面所有的“unicode字符串”指的都是python里的“unicode对象”。

#!/usr/bin/python
#coding=utf-8
s='文博';
print s;

会出现乱码

#!/usr/bin/python
#coding=utf-8
s=u'文博';
print s;

不会出现乱码。

原文地址:https://www.cnblogs.com/liuwenbohhh/p/4928055.html