私はこのように解析し.txt
ます:
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))
cols
インデックスが使えるリストだと思います。希望どおりに正しい結果を出力することはできますが、範囲外のエラーがあります。
ファイル"./tdseq.py"、37行目、parse_file時間= cols [4] IndexError:リストインデックスが範囲外ですmake:* [all]エラー1
私が使用するデータ:
I10.FE,--,xx,xxxx,13450,tt,tt,tt,33,22,22:33:44