Help for unicode

David Eppstein eppstein at ics.uci.edu
Sun Nov 9 20:27:21 CET 2003


In article <2perb.101236$vO5.3965040 at twister1.libero.it>,
 "Noixe" <NoixeTOGLIMI at hotmail.com> wrote:

> If I write:
> 
> print u'\u2205'
> 
> I have this error: UnicodeError: ASCII encoding error: ordinal not in
> range(128)
> 
> 
> Why? I must include some module?

You have to specify which encoding you want to print it in.
E.g. 
>>> print u'\u2205'.encode('utf8')

Of course this will only work if the output stream you print to is set 
up to use that encoding...

-- 
David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science




More information about the Python-list mailing list