【发布时间】:2015-08-25 12:28:32
【问题描述】:
我有一个包含 25 列的文本文件(大量浮点数)。我想提取第 14 列并将其除以第 15 列。我无法提取这两列。
代码:
with open('sample for north.txt') as infile:
for line in infile:
print(line.split()[13])
错误:列表索引超出范围
【问题讨论】:
-
print(line.split())带给你什么? -
@tmoreau 结果是 ['#']