FAQ: how to vary the byte offset of a field of a ctypes.Structure
p.lavarre at ieee.org
p.lavarre at ieee.org
Mon Jun 4 11:53:03 EDT 2007
> > http://docs.python.org/lib/module-pickle.html
> > ... concise Python ways of pickling and unpickling
> > the (0xFF ** N) possible ways of
> > packing N strings of byte lengths of 0..xFE together ...
Aye, looks like an exercise left open for the student to complete:
>>> pickle.dumps("")
"S''\np0\n."
>>>
>>> pickle.dumps("abc")
"S'abc'\np0\n."
>>>
>>> pickle.loads(pickle.dumps("abc"))
'abc'
>>>
>>> pickle.dumps(ctypes.c_ubyte(0))
...
TypeError: abstract class
>>>
More information about the Python-list
mailing list