005-基础-使用字典实现菜单功能,同时调用相应的函数

005-基础-使用字典实现菜单功能,同时调用相应的函数

 1 def syncdb():
 2     print ("syncdb.....")
 3 def stop_server(name):
 4     print("%s stop server....." %(name))
 5 
 6 actions = {
 7     'stop': stop_server,
 8     'syncdb': syncdb,
 9 }
10 
11 actions["stop"]("wj")

 





posted @ 2020-11-20 15:14  紫电清霜  阅读(75)  评论(0编辑  收藏  举报