字典小练习

请设计一个dict, 存储你们公司每个人的信息, 信息包含至少姓名、年龄、电话、职位、工资,并提供一个简单的查找接口,用户按你的要求输入要查找的人,你的程序把查到的信息打印出来

dic = {'ryan':{'age':18,'cell':12343545,'pos':'leader','salary':100000},'tracy':{'age':19,'cell':12243325,'pos':'mishu','salary':3434254}}
cell = input('phone number:').strip()
if cell.isdigit():
    cell = int(cell)
    for i in dic:
        if dic[i]['cell'] == cell:
            print('姓名:%s 年龄:%s '%(i,dic[i]['age']))
#phone number:12343545
#姓名:ryan 年龄:18 
原文地址:https://www.cnblogs.com/thanos-ryan/p/13258019.html