encoding

如果我想打印UTF-8字符串,我应该写:
打印u"Hello Word"
但是,如果我想打印变量怎么办?
谢谢

# 回答1


甘道夫·施里布:
不,你不写.你写
打印u"Hello world".encode("utf-8")
请阅读:http://www.reportlab.com/i18n/python..._tutorial.html
那你就做了
打印variable_containing_unicode_object.encode("utf-8")
迪兹
# 回答2


9月1日晚上11:59*"Diez B.Roggisch" 不,你不写.你写
打印u"Hello world".encode("utf-8")
请阅读:http://www.reportlab.com/i18n/python..._tutorial.html
那你就做了
打印variable_containing_unicode_object.encode("utf-8")
迪兹
谢谢
# 回答3


甘道夫写道:
U"Hello world"不是一个UTF-8编码的字符串.这是一个Unicode字符串.
我建议你读一读http://www.joelonsoftware.com/articles/Unicode.html
克里斯蒂安

标签: python

添加新评论