match casePublished by onesixx on 22-04-0522-04-05 Python구조적-패턴-매칭-파이썬에서-switchcase문 https://youtu.be/2yHZSPZdh-o Python status = 200 # if status == 200: # print("OK!") # elif status == 300: # print("Err") # else: # print("unknown") # switch py=3.10 match status: case 200: print("OK!") case 300 | 400: print("Err") case _: print("unknown") switch case와 달리, 패턴 매칭 Python def draw(point) match point: case(x, y): print(f'x:{x}, y:{y}') case(x, y, z): print(f'x:{x}, y:{y}, z:{z}') draw(10,20,30) draw(10,20) Python ... Categories: Python Basic onesixx Blog Owner Label {} [+] Name* Email Δ Label {} [+] Name* Email Δ 0 Comments Inline Feedbacks View all comments