def fetch(data): print(' 查询功能') print('用户数据是',data) def add(): pass def change(): pass def delete(): pass if __name__ == '__main__': msg = ''' 1: 查询 2. 添加 3. 修改 4. 删除 5. 退出 ''' msg_dict = { '1': fetch, '2': add, '3': change, '4': delete } while True: print(msg) choice = input('请输入你的选项:').strip() if not choice: continue if choice == '5': break data = input('请输入你的数据:').strip() msg_dict[choice](data)