Madavian
Programmer
- Jan 15, 2003
- 5
I have to process text files with fixed length fields.
Does Python provide for a way to define the fields?
I need something like the following.
text file = 'aaabccccccccddddeff...'
converted to :-
field1 = 'aaa'
field2 = 'b'
field3 = 'cccccccc'
etc....
I am using - field1 = file[0:3] # for first field
I am sure that there must be a better way.
Thanks
Does Python provide for a way to define the fields?
I need something like the following.
text file = 'aaabccccccccddddeff...'
converted to :-
field1 = 'aaa'
field2 = 'b'
field3 = 'cccccccc'
etc....
I am using - field1 = file[0:3] # for first field
I am sure that there must be a better way.
Thanks