Problem with Unicode char in Python 3.3.0

marduk marduk at python.net
Sun Jan 6 12:10:08 EST 2013



On Sun, Jan 6, 2013, at 11:43 AM, Franck Ditter wrote:
> Hi !
> I work on MacOS-X Lion and IDLE/Python 3.3.0
> I can't get the treble key (U1D11E) !
> 
> >>> "\U1D11E"
> SyntaxError: (unicode error) 'unicodeescape' codec can't 
> decode bytes in position 0-6: end of string in escape sequence
> 

You probably meant:

>>> '\U0001d11e'


For that synax you must use either '\uXXXX' or '\UXXXXXXXX' (i.e.
specify either 4 or 8 hex digits).

http://docs.python.org/2/howto/unicode#unicode-literals-in-python-source-code




More information about the Python-list mailing list