您的当前位置:首页正文

python字典查询功能

来源:个人技术集锦
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 = { '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)

因篇幅问题不能全部显示,请点此查看更多更全内容