Creating Fixed Length Records
Stuart D. Gathman
stuart at bmsi.com
Thu Dec 9 04:15:24 CET 2004
On Wed, 08 Dec 2004 17:29:19 -0600, Greg Lindstrom wrote:
> One thought I had, which might lead to an addition to the language, was
> to use the struct module. If I could feed the pack method a format
> string then a tuple of values (instead of individual values), then I
> could create the format string once, then pass it a tuple with the
> values for that record. Just a thought.
The language extension has been around since the early days. It was
originally called 'apply'. But now is called '*'.
>>> import struct
>>> fmt = '8s6s2s'
>>> v = ('foo','bar','AA')
Stuart D. Gathman <stuart at bmsi.com>
Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flamis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.
More information about the Python-list