📜  match 语句 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:02.491000             🧑  作者: Mango

代码示例1
def http_error(status):
    match status:
        case 400:
            return "Bad request"
        case 404:
            return "Not found"
        case 418:
            return "I'm a teapot"
        case _:
            return "Something's wrong with the internet"