def select(): print(‘select功能‘) def delete(): print(‘delete功能‘) def insert(): print(‘insert功能‘) def updata(): print(‘updata功能‘) dic = { ‘select‘:‘select‘, ‘delete‘:‘delete‘, ‘insert‘:‘insert‘, ‘updata‘:‘updata‘ } def main (): while True: inp=input(‘>>‘).strip() if not inp:continue for i in dic: if inp in i: inp() # if inp == ‘select‘: # select() # elif inp ==‘delete‘: # delete() # elif inp ==‘insert‘: # insert() # elif inp == ‘updata‘: # updata() # else: # print(‘输入有误.‘) # continue main()
原文:http://www.cnblogs.com/sunkedong/p/7538265.html