py
.py dictionary, 함수 연동
jm_p_op
2023. 3. 29. 11:25
def f1(a, b):
return a
def f2(a, b):
return b
calc_dic = {"first": f1,
"second": f2}
calc_dic["first"](1, 2)
print(calc_dic["first"](1, 2)) # 1
print(calc_dic["second"](1, 2)) # 2