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   liuwenbohhh  阅读(302)  评论(0编辑  收藏  举报

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示