struct.pack returns nothing

Alex Martelli aleax at mac.com
Mon Mar 19 01:22:32 EDT 2007


<andmarti at gmail.com> wrote:

> If I build a strict with:
> 
> import struct
> print struck.pack ('i', 1)
> 
> it returns a '\n'.
> What's wrong with it???
> :(

You're trying to print a binary string that's hardly printable as-is.
Try printing its repr(...) and you'll see all the binary zeros and one
you crave!-)


Alex




More information about the Python-list mailing list