syntaxerror: unexpected character after line continuation character in python

后端 未结 3 1045
别跟我提以往
别跟我提以往 2020-12-11 22:48

Can anybody tell me what is wrong in this program? I face

syntaxerror unexpected character after line continuation character

when I run this

3条回答
  •  爱一瞬间的悲伤
    2020-12-11 23:43

    Replace

    f = open(D\\python\\HW\\2_1 - Copy.cp,"r");

    by

    f = open("D:\\python\\HW\\2_1 - Copy.cp", "r")

    1. File path needs to be a string (constant)
    2. need colon in Windows file path
    3. space after comma for better style
    4. ; after statement is allowed but fugly.

    What tutorial are you using?

提交回复
热议问题