Escape sequence "\xhh.." not yet implemented??

Tim Peters tim_one at email.msn.com
Tue Nov 14 20:44:52 EST 2000


[June Kim. about \x escapes]

See

    http://python.sourceforge.net/peps/pep-0223.html

for a full account; this PEP was implemented late in the 2.0 release cycle;
all the docs may not have caught up.

> ...
> However, to my disappointment, the current Python 2.0 final doesn't work
> that way; it takes only two letters after \x just like old Python did.
>
> >>> '\xA0A0'
> '\240A0'

I don't know what you mean by "old Python".  Python releases prior to 2.0
consumed any number of hex digits after \x, but silently ignored all but the
last two digits; for the example above, they displayed

'\240'

> ...
> ps. btw, I don't understand the last bit in the parentheses.

It meant that all but the last two hex digits were silently ignored.  This
is no longer true, though (as of 2.0).

glad-there's-a-pep-ly y'rs  - tim






More information about the Python-list mailing list