Importing data from a text file using python

Posted by Will on Stack Overflow See other posts from Stack Overflow or by Will
Published on 2010-06-10T07:13:26Z Indexed on 2010/06/10 7:22 UTC
Read the original article Hit count: 163

Filed under:
|

I have a text file containing data in rows and columns (~17000 rows in total). Each column is a uniform number of characters long, with the 'unused' characters filled in by spaces. For example, the first column is 11 characters long, but the last four characters in that column are always spaces (so that it appears to be a nice column when viewed with a text editor). Sometimes it's more than four if the entry is less than 7 characters.

The columns are not otherwise separated by commas, tabs, or spaces. They are also not all the same number of characters (the first two are 11, the next two are 8 and the last one is 5 - but again, some are spaces).

What I want to do is import the entires (which are numbers) in the last two columns if the second column contains the string 'OW' somewhere in it. Any help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about python

Related posts about beginner