John Filben wrote:
Can someone please let me know how to read a file one record at a time (just
say fixed block for now - see small example below) and assign columns to
fields. Then reference the field names with if-then-else logic.
Sample Fixed Block File:
John98762
John82634
John11234
Thank you.
John Filben
Cell Phone - 773.401.2822
Email - [email protected]
The other responses all seem to assume that you have linefeeds between
records. But you said it was fixed-block, which implies no linefeeds.
Anyway, to fetch those blocks, use the file.read() method, where you
can give the fixed size. You can separate the blocks with slicing, or
you can do something trickier.
DaveA
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor