This is what I came up with:
Code: Select all
from array import array
from struct import pack
a = array('i', range(4))
# this works - is there a way to get rid of the loop?
# i.e. have C do the looping ...
for i in a:
print(pack('i', i))
# TypeError: can't convert array to int
print(pack('4i', a))