python字典查询功能

时间:2023-03-09 00:06:55
python字典查询功能
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 = {
'': fetch,
'': add,
'': change,
'': delete
} while True:
print(msg)
choice = input('请输入你的选项:').strip() if not choice:
continue
if choice == '':
break data = input('请输入你的数据:').strip()
msg_dict[choice](data)