Using struct writing integers

thomas at thomas at
Thu Apr 27 13:22:44 EDT 2000


I got a list of tuples containing integers, like :

stuff = [ (21,323,32), (432,43,3234), (432,565,532), (434,43,987) ]

Each tuple in the list represent an id for a entry in a database, the
three integers form a key. The list above contains four ids. I want to
write them to a binary file using the struct module. Then I want to
read them pack, unpack them into the same kind of list.

Any hints, examples etc?



More information about the Python-list mailing list