switch 列表式函数
作者:互联网
def case1():
print(1)
def case2():
print(2)
def case3():
print(3)
def case4():
print(4)
switch = {
‘case1’: lambda: case1(),
‘case2’: lambda: case2(),
‘case3’: lambda: case3(),
‘case4’: lambda: case4(),
}
case = lambda case_name: switch.get(case_name)()
case(“case1”)
标签:case,函数,列表,case1,switch,print,def,lambda 来源: https://blog.csdn.net/weixin_35984233/article/details/120909284