does python could support sequence of short or int?

Richard Brodie R.Brodie at rl.ac.uk
Thu Mar 30 08:21:27 EST 2006


"momobear" <wgwigw at gmail.com> wrote in message 
news:1143722234.988260.201690 at t31g2000cwb.googlegroups.com...

> 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.

I'm not sure why you think that the array and struct modules are
unsuitable:

>>>import array
>>>buffer = 'iidfkljkkkkhfpa3'
>>>arr = array.array('h', buffer)
>>> print arr
array('h', [26985, 26212, 27755, 27498, 27499, 26731, 28774, 13153])






More information about the Python-list mailing list