[Tutor] Need help with structure unpacking module

Alan Gauld alan.gauld at btinternet.com
Tue Mar 18 16:12:06 CET 2008


"Alan Gauld" <alan.gauld at btinternet.com> wrote 

>>    >>>first = struct.unpack('cccc', '\x02\x00')
>>     error: unpack requires a string argument of length 4
> 
> And here you asked for 54 characters but only gave
> it two bytes.  And the two byes were 02 and 00 which
> are not printable characters.

Oops!
This should of course have been 4 characters. And 
the printableness is an observation but does not 
have any direct effect on the viability of the operation.

Alan G



More information about the Tutor mailing list