IndexError:列表索引超出范围(CSV文件代码)

时间:2019-05-09 20:42:37

标签: python csv

我正尝试使用以下代码查找在csv文件中单词DELIVERED出现多少次。这段代码是我获得的参考,我试图在同一参考中进行构建。 以下是我正在使用的代码

import csv
import collections

Title = collections.Counter()
with open('detailed_report.csv') as input_file:
    for row in csv.reader(input_file, delimiter=';'):
        Title[row[1]] += 1

print ('%s'%Title['DELIVERED'])

尝试运行此代码时出现以下错误

IndexError: list index out of range

Process finished with exit code 1

0 个答案:

没有答案