Building Very Large Records
aleaxit at yahoo.com
Sat Sep 11 00:17:27 CEST 2004
Greg Lindstrom <greg.lindstrom at novasyshealth.com> wrote:
> I am working on a routine to pull information from an Oracle database and
> format it into fixed-length records. My problem is that the record layout
> is quite long (over 500 bytes) and contains dozens of fields. How would
> *you* go about building such a beast? I know that using the += operator is
> a bad idea, as it creates a new copy of the string each time. How about the
> struct.pack() method? A very big '%-12.12s%-50.50s.......' statement?
Yep, except that what you're quoting ain't a statement, just a string.
But put a % after it and the right tuple after that, and you''re going
More information about the Python-list