momobear wrote: > then how can I convert it to a int list? I read about struct and array, > I think they are not suitable, since I don't know how long will the > buffer is. I know if I write a plugins modules in C should works, but > that's really upset to tell to myself there is no way in Python.
You think wrong - they _are_ suitable. You can create the struct.unpack-format string on the fly, which allows you to do this: import struct some_ints = range(1000) v = struct.pack("%ih" % len(some_ints), *some_ints) print struct.unpack("%ih" % len(some_ints), v) Regards, Diez -- http://mail.python.org/mailman/listinfo/python-list