SyntaxError: unexpected EOF while parsing

前端 未结 6 915
抹茶落季
抹茶落季 2020-11-28 06:44

I am getting error while running this part of the code. tried some of the existing solutions, none of them helped

elec_and_weather = pd.read_csv(r\'C:\\HOUR.         


        
6条回答
  •  天涯浪人
    2020-11-28 07:34

    There are some cases can lead to this issue, if it occered in the middle of the code it will be "IndentationError: expected an indented block" or "SyntaxError: invalid syntax", if it at the last line it may "SyntaxError: unexpected EOF while parsing":

    Missing body of “if,while or for” statement-->

    root@nest:~/workplace# cat test.py
    l = [1,2,3]
    for i in l:
    root@nest:~/workplace# python3 test.py
      File "test.py", line 3
    
                   ^
    SyntaxError: unexpected EOF while parsing
    

    Unclosed parentheses (Especially in complex nested states)-->

    root@nest:~/workplace# cat test.py
    l = [1,2,3]
    print( l
    root@nest:~/workplace# python3 test.py
      File "test.py", line 3
    
                ^
    SyntaxError: unexpected EOF while parsing
    

提交回复
热议问题