遍历列表,打印:我叫name,今年age岁,家住dizhi,电话phone(我是通过下标取键得到对应值,有哪位大神来个更简单的)
2024-10-01 10:09:40
lt = [
{'name':'小王', 'age':18, 'info':[('phone', '123'), ('dizhi', '广州')]},
{'name':'小芳', 'age':19, 'info':[('phone', '789'), ('dizhi', '深圳')]},
{'name':'小杜', 'age':22, 'info':[('phone', '567'), ('dizhi', '北京')]},
{'name':'小孟', 'age':28, 'info':[('phone', '000'), ('dizhi', '上海')]},
{'name':'小乔', 'age':26, 'info':[('phone', '111'), ('dizhi', '河南')]},
]
i = len(lt)
for b in range(i):
print('我叫{},今年{}岁,家住{},电话{}'.format(lt[b].get("name"), lt[b].get("age"), lt[b].get("info")[1][1],lt[b].get("info")[0][1]) )
最新文章
- MyCAT日志分析
- RedHat Linux RHEL6配置本地YUM源
- ios下fixed回复框bug的解决方案
- dynamic 的使用 待续
- 15天玩转redis —— 第四篇 哈希对象类型
- C# Redis使用之StackExchange
- native2ascii 国际资源文件编码
- 如何使用TestFlight进行Beta测试
- php 安装 sphinx
- Linux基础01 学会使用命令帮助
- unity基本操作二
- MAC下《暗黑世界》客户端版本编译说明!!
- 查看本机上的端口使用情况netstat -an
- cuda8.0环境下安装py-faster-rcnn问题总结
- 六、Spring Boot Controller使用
- 普通程序员如何转向AI方向(转)
- js常见的面试题
- 远程执行shell脚本的小技巧
- TensorFlow升级1.4:Cannot remove entries from nonexistent file \lib\site-pack
- table边框