尝试从保存位置调用csv文件

时间:2013-11-28 18:47:11

标签: python csv

import os
import csv

infile = open("PearsonFebruary2012.csv","rb")

reader = csv.reader(infile)
for i in range(0.17):
    reader.next()
#The reader below this one
print reader.next()

#I am getting the error that reader is an invalid syntax.

1 个答案:

答案 0 :(得分:1)

看起来你有一个错字。您的0.17应为0,17

Marijn正确地指出存在两个问题,因为使用float作为range的参数会生成TypeError