[Python-bugs-list] Hexadecimal to specify char in string literal (PR#276)
guido@python.org
guido@python.org
Wed, 5 Apr 2000 15:37:40 -0400 (EDT)
> After
>
> s = 'abc\x09def'
>
> s has the value 'abc\xef' == 'abc\357'.
>
> In fact, it appears that you can put as many hex chars ([0-9a-f])
> as you want between the 'x' and the final 'ef', and you will get
> the same result.
>
> (Hard to believe that this has not been reported, but I can't find
> it on python.org or deja.)
This is not a bug. It is how the \x escape is defined in ANSI C and
I just copied it from there. It is also documented.
--Guido van Rossum (home page: http://www.python.org/~guido/)