Use a Unicode literal (a string literal with leading u ) to represent a unicode string:
>>> frase = u'La canción de la piƱa' >>> print frase.upper() LA CANCIĆN DE LA PIĆA
UPDATE
Adding the next line at the beginning of the file includes automatic literals in Unicode format. (In the interactive shell, statements will depend on import operators.)
from __future__ import unicode_literals
See __future__ definitions of future statements .
source share