String backslash characters

Benji York benji at
Fri Dec 24 06:09:00 CET 2004

PD wrote:
> I am new to python, but i am quite curious about the following.
> print '\378'
> which should not work because \377 is the max. then it displays two
> characters (an 8 and a heart in my case...). What else does'nt quite
> make sense is that if this is an octal why is an 8 accepted?

It would appear that the parser reads \377 as a single character and 
\378 as two (\37 and the "8" character).  I'm somewhat surprised you're 
seeing a heart and an 8.  What OS/language combination are you using? 
If you're using English Windows you can get a heart and an "8" with 
"print '\38'".
Benji York
benji at

More information about the Python-list mailing list