number conversion
Peter Hansen
peter at engcorp.com
Wed Apr 6 17:10:03 EDT 2005
nicksjacobson at yahoo.com wrote:
> fmt = str(chunklen) + 'B'
> fmtsize = struct.calcsize(fmt)
> rawdata = struct.unpack(fmt, s[:fmtsize])
> rawdata = list(rawdata)
>
> Then I tried to convert it:
>
> charary = array.array('b')
> charary.fromlist(rawdata)
Uh, don't you want to be consistent in your use
of signed and unsigned characters? You've got
both a 'B' and a 'b' above, and I believe you
need to pick one and stick with it...
More information about the Python-list
mailing list