struct.pack returns nothing

A

andmarti

If I build a strict with:

import struct
print struck.pack ('i', 1)

it returns a '\n'.
What's wrong with it???
:(
 
A

Alex Martelli

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
 
A

AWasilenko

If I build a strict with:

import struct
print struck.pack ('i', 1)

it returns a '\n'.
What's wrong with it???
:(

Looks like you spelled struct wrong in the code :)
 
A

andmarti

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!-)

Im getting nothing as well.
The unpack seems to work fine though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top