Little direction please Python MySQL
len
lsumnler at gmail.com
Mon Nov 17 10:51:32 EST 2008
On Nov 17, 3:24 am, Lawrence D'Oliveiro <l... at geek-
central.gen.new_zealand> wrote:
> len wrote:
> > Files are fixed format no field delimiters, fields are position and
> > length records are terminated by newline.
>
> Assuming no COMPUTATIONAL fields, it should be easy enough to split each line up into fixed-length pieces, e.g. assuming a simple example
>
> 01 Sample-Record.
> 02 Field-1 pic XXX.
> 02 Field-2 pic XXXX.
> 02 Field-3 pic XXXXX.
>
> then a Python sequence that read one line's worth of fields might be
>
> line = infile.read()
> (field_1, field_2, field_3) = (line[0:3], line[3:7], line[7:12])
More information about the Python-list
mailing list