encoding

Diez B. Roggisch deets at nospam.web.de
Mon Sep 1 17:59:16 EDT 2008


Gandalf schrieb:
> if i want to print utf-8 string i should writre:
> 
> print u"hello word"

No, you don't. You write

print u"hello world".encode("utf-8")

Read this:

http://www.reportlab.com/i18n/python_unicode_tutorial.html

> but what happen if i want to print variable?

Then you do

print variable_containing_unicode_object.encode("utf-8")

Diez



More information about the Python-list mailing list