Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text field decleration

Status
Not open for further replies.

Madavian

Programmer
Joined
Jan 15, 2003
Messages
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top