提问人:lexi_roro 提问时间:7/29/2023 更新时间:7/29/2023 访问量:140
为什么我在 Python 中收到使用 match 的错误消息?
Why am I getting an error message in Python for using match?
问:
当我键入单词 Match 时,我在 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: ^ SyntaxError:语法无效
我检查了我的语法是否正确,确实如此。我不确定我拥有的版本是否不再接受匹配
答: 暂无答案
评论
print(sys.version)
sys.version
sys.error