0
点赞
收藏
分享

微信扫一扫

Python-字典(嵌套)

笙烛 2022-06-06 阅读 112

"""字典中嵌套字典"""users = {
'wen': {
'first': 'zhou', 'last': 'wen', 'location': 'hubei' }, 'tao': {
'first': 'zhou', 'last': 'tao', 'location': 'hubei' }
}

for username,userinfo in users.items():
print('username:'+username)
fullname = userinfo['first']+userinfo['last']
location = userinfo['location']
print('fullname:'+fullname)
print('location:'+location)
print('\t')

举报

相关推荐

0 条评论