python strings
Bryan
belred at gmail.com
Thu May 4 00:01:51 EDT 2006
Gerhard Häring wrote:
> Python 2.4.2 (#2, Sep 30 2005, 21:19:01)
> [GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> s = "\x000"
>>>> s[0] == chr(0)
> True
>
> - -- Gerhard
this works too :)
>>> s = '\x001'
>>> s[0] == chr(0)
True
>>> s = '\x00abc'
>>> s[0] == chr(0)
True
i think it would be more clear not to use 3 digits for this example since \x
only uses the next two numbers, not 3.
>>> s = '\x00'
>>> s[0] == chr(0)
True
bryan
More information about the Python-list
mailing list