Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我使用 except: 时出现语法错误:即使是简单的 try: a=0 except: 语句
try : a=0 print(a + 2) except :
错误是
SyntaxError: invalid syntax
您的代码有缩进错误。它应该是这样的:
try: a = 0 print (a+2) except: #do something