python strings

Gerhard Häring gh at ghaering.de
Wed May 3 15:47:29 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

mike7411 at gmail.com wrote:
> Is it possible for python strings to contain a zero byte?

Yes. Here's how to produce one:

gerhard at lara:~$ python
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEWQjRdIO4ozGCH14RAsf4AJ4xdbT/FQTSzfciijgVBEfMyTH8SQCeJP39
xzJxWxlAnRgKimsKSKWhSQ0=
=Dd3B
-----END PGP SIGNATURE-----



More information about the Python-list mailing list