nonascii symbols

Troels Therkelsen t_therkelsen at hotmail.com
Sat Jul 10 07:10:29 EDT 2004


In article <4dLHc.994550$Pk3.764369 at pd7tw1no>, Elaine Jackson wrote:
> What's the trick for using nonascii symbols in string literals?
> 
>

Here's one way of doing it:
 
Python 2.4a1 (#1, Jul  9 2004, 21:24:13) 
[GCC 2.95.3 20010315 (release)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print "\xef"
ï
>>> 

Or, in other words, use backslash+x+hexadecimal number representing the byte
value of the symbol you wish to use.  Be aware that exactly which symbol
appears when printed depends on the character encoding of your terminal.

For all the ways of doing this see:

   http://www.python.org/dev/doc/devel/ref/strings.html

Best regards,

Troels Therkelsen




More information about the Python-list mailing list