with open csv SyntaxError:解析

时间:2017-10-28 04:27:42

标签: python file parsing

with open("file.csv" "rt") as file:

  File "<ipython-input-20-911a921>", line 1
    with open("file.csv" "rt") as file:
                                         ^
SyntaxError: unexpected EOF while parsing

任何想法为什么它给了我这个错误。 file.csv与我当前的Jupyter笔记本在同一目录下

2 个答案:

答案 0 :(得分:0)

你需要一个逗号。它将参数分开。

with open("file.csv", "rt") as file:
#                   ^
#               right here

答案 1 :(得分:0)

with open("file.csv" "rt") as file: 

更改为

with open("file.csv", "rt") as file: