📜  python match 语句 - Python 代码示例

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

代码示例1
# Only supported 3.10+

# _ is the symbol for wildcard
match value:
  case Case1:
    ...
  case Case2:
    ...
  case (5, _): # if value is some tuple with first element 5
    ...
  case _: # you can implement a fall-through like this
    ...