sorry for this stupid question about struct module

jepler at jepler at
Thu Sep 19 18:19:53 EDT 2002

>>> '\x00\x00\x00\n' == '\x00\x00\x00\x0A'

Ascii code 10 is repr()'d as \n.

If you don't like this, you could use a different function to print the
quoted value of a string:

>>> quote = lambda s: "'" + "".join(["\\x%02x" % ord(c) for c in s]) + "'"
>>> print quote("\0\0\0\n")


More information about the Python-list mailing list