当我键入“匹配”一词时,我在 Python 中收到语法错误。我什至有最新版本的Python 3.11.4
http_status = 200
if http_status == 200 or http_status == 201:
print("success")
elif http_status == 400:
print("Bad request")
elif http_status == 404:
print("Not found")
elif http_status == 500 or http_status == 501:
print("Server Error")
else:
print("Unknown")
match http_status:
case 200:
print("success")
错误信息:
匹配http_status: ^ 语法错误:语法无效
我检查了我的语法是否正确,确实如此。我不确定我的版本是否不再接受匹配