parsing tab and newline delimited text
kerensaelise at hotmail.com
Wed Aug 4 04:14:30 CEST 2010
I have a large file of text I need to parse. Individual 'entries' are
separated by newline characters, while fields within each entry are
separated by tab characters.
So, an individual entry might have this form (in printed form):
Title date position data
with each field separated by tabs, and a newline at the end of data.
So, I thought I could simply open a file, read each line in in turn,
and parse it....
However, 'data' is a fairly random string of characters. Because the
files I'm processing are large, there is a good chance that in every
file, there is a data field that might look like this:
or like this:
so, you see the random strings '\n' and '\t' are stopping me from
being able to parse my file correctly. Any
suggestions on how to overcome this problem would be greatly
More information about the Python-list