美文网首页
Chapter 6 字典

Chapter 6 字典

作者: Smnag | 来源:发表于2019-06-01 23:02 被阅读0次

在字典中储存字典

people = {
    'Joey': {
        'first_name': 'Joey', 
        'last_name': 'Chou', 
        'age': 26, 
        'city':'Shenzhen',
        },
    'Alyx': {
        'first_name': 'Alyx',
        'last_name': 'Lou',
        'age': 28,
        'city': 'Beijing',
    },
    'Daisy': {
        'first_name': 'Daisy',
        'last_name': "Zhang",
        'age': 29,
        'city': 'Shanghai',
    },
}

for friend, info in people.items():
    print("\nFreind's Name :" + friend)
    full_name = info['first_name'] + ' ' + info['last_name']
    age = info['age']
    location = info['city']
        print('\tFull name: ' + full_name )
        print('\tAge :' + str(age))
        print('\tLocation: ' + location ) 
屏幕快照 2019-06-01 下午11.01.53.png

相关文章

  • Chapter 6 字典

    在字典中储存字典

  • 《flask Web 开发》读书笔记 & chapter

    chapter 2 - chapter 3 - chapter 4 - chapter 5 - chapter 6...

  • Chapter 06:字典

    字典,类比C++中的map green5 对字典中不存在的key进行赋值相当于添加 {'color': 'gree...

  • Ch6 CPU Scheduling

    Chapter 6: CPU Scheduling Table of Contents Chapter 6: CP...

  • Everyone was Telemachus once

    From chapter 1 to chapter 6,there are two characters tha...

  • 06词的分类

    Chapter6word classification This chapter covers 2 parts, ...

  • 字典6

    61、【用户任务的闭环】 指的是一系列帮助用户完成任务的环节,这些环节可以应对任务可能出现的各种情况。 62、【墨...

  • 6、字典

    字典 字典一种key - value 的数据类型,使用就像我们上学用的字典,通过笔划、字母来查对应页的详细内容。 ...

  • Effective Objective-C 2.0 Tips 总

    Effective Objective-C 2.0 Tips 总结 Chapter 5,6,7 Chapter 5...

  • 跟着大大学python(16)

    6 字典 6.1 一个简单的字典 字典 高效地模拟现实世界的情形 6.2 使用字典 python中,'字典是一系列...

网友评论

      本文标题:Chapter 6 字典

      本文链接:https://www.haomeiwen.com/subject/akpztctx.html