pack a three byte int
p.lavarre at ieee.org
p.lavarre at ieee.org
Thu Nov 9 18:16:42 EST 2006
> Not as concisely as a one-byte struct code
Help, what do you mean?
> you presumably... read... the manual ...
Did I reread the wrong parts? I see I could define a ctypes.Structure
since 2.5, but that would be neither concise, nor since 2.3.
> when 24-bit machines become ... popular
Indeed the struct's defined recently, ~1980, were contorted to make
them easy to say in C, which makes them easy to say in Python, e.g.:
X28Read10 = 0x28
cdb = struct.pack('>BBIBHB', X28Read10, 0, skip, 0, count, 0)
But when talking the 1960's lingo I find I am actually resorting to
horrors like:
X12Inquiry = 0x12
xxs = [0] * 6
xxs[0] = X12Inquiry
xxs[4] = allocationLength
rq = ''.join([chr(xx) for xx in xxs])
Surely this is wrong? A failure on my part to think in Python?
More information about the Python-list
mailing list