I parse a .txt like this:
def parse_file(src):
for line in src.readlines():
if re.search('SecId', line):
continue
else:
cols = line.split(',')
Time = cols[4]
output_file.write('{}\n'.format(
Time))
I think cols are lists that I could use index. Although it succeeds in printing out correct result as I want, there exists an out of range error. What's the matter?
File "./tdseq.py", line 37, in parse_file
Time = cols[4]
IndexError: list index out of range
make: *** [all] Error 1
Data I use:
I10.FE,--,2008-04-16,15:15:00,13450,13488,13450,13470,490,359,16APR2008:09:15:00
I10.FE,--,2008-04-16,15:16:00,13468,13473.8,13467,13467,306,521,16APR2008:09:16:00
....