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;

不会出现乱码。

 

posted on 2015-11-01 16:18  liuwenbohhh  阅读(306)  评论(0)    收藏  举报