第8行:SyntaxError - 输入错误('')

1 python syntax-error

为什么顶级的不能正常工作,但最底层的却不行?我认为这是空间问题,但它看起来完全相同.有什么问题?

破碎的代码:

month = int(input("Enter the month: "))
day = int(input("Enter the day: "))

if (month == 9):
    if (day <= 15):
     print ("First half of the month")
    else:
?    print ("Second half of the month") #The line with the error
else:
 print ("Not in September")
Run Code Online (Sandbox Code Playgroud)

工作代码:

month = int(input("Enter the month: "))
day = int(input("Enter the day: "))

if (month == 9):
    if (day <= 15):
     print ("First half of the month")
    else:
     print ("Second half of the month")
else:
 print ("Not in September")
Run Code Online (Sandbox Code Playgroud)

Joh*_*ohn 6

在该行的开头有一个不可见的字符('非标准'空格).

角色是EM SPACE(U + 2003),看起来与普通空间相同.

我发现这是通过将代码复制到记事本++然后去查看>显示符号并启用'显示所有字符'