encoding problem

"Martin v. Löwis" martin at v.loewis.de
Thu Mar 9 08:58:41 EST 2006


Yves Glodt wrote:
> It seems in general I have trouble with special characters...
> What is the python way to deal with éàè öäü etc...
> 
> print 'é' fails here,
> print u'é' as well :-(
> 
> How am I supposed to print non-ascii characters the correct way?

The second form should be used, but not in interactive mode.
In a Python script, make sure you properly declare the encoding
of your script, e.g.

# -*- coding: iso-8859-1 -*-
print u'é'

That should work. If not, give us your Python version, operating
system name, and mode of operation.

Regards,
Martin



More information about the Python-list mailing list