What is the purpose of "struct" and "array" modules
Scott David Daniels
Scott.Daniels at Acm.Org
Thu May 28 17:51:22 EDT 2009
Igor Katson wrote:
> I pretty much understand what they do, but what's the case of using
> these modules by example? Is it something like pickle, to store the data
> efficiently in files?
Mostly it is for access to specific binary data structures.
If you know a particular file format, you can read it with
a combination of struct and array, ans similarly can write
in that format by such use. So like pickle in a way, but
pickle is talking Python-to-Python, while things built with
these will be more likely Python-to-wire or wire-to-Python
when talking over a TCP/IP connection, or Python-to-file
and file-to-Python, where the other user of the file may be
a completely different program.
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list