when ever I need to use the struct module
I always store my values in a list or a dict, then
I do something like the code below

import struct
list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
length =len(list)
struct.pack(">%di"%(length), *[i for i in list])

now I can not remember where I came up with that,
I thought I read it in the python docs somewhere
but I can not find any mention of it now.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to