def account_info(): pass def repay(): pass menu = ''' ------- 请选择以下菜单 --------- 1. 账户信息 2. 还款 3. 取款 4. 转账 5. 账单 6. 退出 ''' # 将函数存储在字典中 menu_dic = { '1': account_info, '2': repay, '3': withdraw, '4': transfer, '5': pay_check, '6': logout, } exit_flag = True while exit_flag: print(menu) user_option = input(">>:").strip() # 根据各户选择的菜单来运行对应的函数处理 if user_option in menu_dic: menu_dic[user_option]() else: print("选择错误!")