Python--函数即变量
def say(name):
print(name)
panda = say
panda('wang')
def add():
print('add')
def view():
print('view')
def delete():
print('delete')
choice = input('请输入选项').strip()
menu = {
'1': add,
'2': view,
'3': delete
}
if choice in menu:
menu[choice]() # 适合用于函数没有参数,或者参数是一样的情况下。
else:
print('输入错误')