使用tensorflow在时间序列中获取缩进错误

时间:2017-10-12 14:19:14

标签: python tensorflow time-series

导入csv文件时出现缩进错误。

我的代码是:

with open('C:/Users/miracle/Desktop/dnh/Sales Data.csv') as f:
        spamreader = csv.reader(f)
        for row in spamreader:
            print(row)

2 个答案:

答案 0 :(得分:1)

确保您的缩进正确无误:

with open('C:/Users/miracle/Desktop/dnh/Sales Data.csv') as f: 
     spamreader = csv.reader(f)
     for row in spamreader: 
         print(row)

答案 1 :(得分:1)

Python会让你使用缩进,因为它是如何理解代码的。

试试这个

with open('C:/Users/miracle/Desktop/dnh/Sales Data.csv') as f: 
    spamreader = csv.reader(f) 
    for row in spamreader: 
        print(row)