nonascii symbols

John Roth newsgroups at jhrothjr.com
Sat Jul 10 08:47:57 EDT 2004


"Troels Therkelsen" <t_therkelsen at hotmail.com> wrote in message
news:slrncevjl4.t6.t_therkelsen at abattoir.2-10.org...
> 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.

Actually, it's supposed to depend on the character encoding comment
at the front of your program. (The default for 2.3 is supposed to be Latin1.
It was supposed to be Ascii for 2.4, but I haven't seen that in the 2.4a1
changes.)

Whether your editor understands this is a different issue.

John Roth


>
> 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