Python学习之路-字典外传

__author__ = "KuanKuan"
info = {'teacher1': '苍井空',
      'teacher2': '京香',
      'teacher3': '波多野结衣',
      'teacher4': '小泽玛利亚',
      'teacher5': '上原瑞惠',
      'teacher6': '樱井莉亚',
      'teacher7': '桃谷绘里香'}
print(info.keys())
d = list(info.keys())[0]
b = list(info.values())[0]
print(d,b)

for index in range(len(info)):
    print(index,list(info.keys())[index],list(info.values())[index])
print("~"*168)
for index in range(len(info)):
    print(index,list(info.keys()),list(info.values()))
# dict_keys(['teacher1', 'teacher2', 'teacher3', 'teacher4', 'teacher5', 'teacher6', 'teacher7'])
# teacher1 苍井空
# 0 teacher1 苍井空
# 1 teacher2 京香
# 2 teacher3 波多野结衣
# 3 teacher4 小泽玛利亚
# 4 teacher5 上原瑞惠
# 5 teacher6 樱井莉亚
# 6 teacher7 桃谷绘里香
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 0 ['teacher1', 'teacher2', 'teacher3', 'teacher4', 'teacher5', 'teacher6', 'teacher7'] ['苍井空', '京香', '波多野结衣', '小泽玛利亚', '上原瑞惠', '樱井莉亚', '桃谷绘里香']
# 1 ['teacher1', 'teacher2', 'teacher3', 'teacher4', 'teacher5', 'teacher6', 'teacher7'] ['苍井空', '京香', '波多野结衣', '小泽玛利亚', '上原瑞惠', '樱井莉亚', '桃谷绘里香']
# 2 ['teacher1', 'teacher2', 'teacher3', 'teacher4', 'teacher5', 'teacher6', 'teacher7'] ['苍井空', '京香', '波多野结衣', '小泽玛利亚', '上原瑞惠', '樱井莉亚', '桃谷绘里香']
# 3 ['teacher1', 'teacher2', 'teacher3', 'teacher4', 'teacher5', 'teacher6', 'teacher7'] ['苍井空', '京香', '波多野结衣', '小泽玛利亚', '上原瑞惠', '樱井莉亚', '桃谷绘里香']
# 4 ['teacher1', 'teacher2', 'teacher3', 'teacher4', 'teacher5', 'teacher6', 'teacher7'] ['苍井空', '京香', '波多野结衣', '小泽玛利亚', '上原瑞惠', '樱井莉亚', '桃谷绘里香']
# 5 ['teacher1', 'teacher2', 'teacher3', 'teacher4', 'teacher5', 'teacher6', 'teacher7'] ['苍井空', '京香', '波多野结衣', '小泽玛利亚', '上原瑞惠', '樱井莉亚', '桃谷绘里香']
# 6 ['teacher1', 'teacher2', 'teacher3', 'teacher4', 'teacher5', 'teacher6', 'teacher7'] ['苍井空', '京香', '波多野结衣', '小泽玛利亚', '上原瑞惠', '樱井莉亚', '桃谷绘里香']

 

posted @ 2018-02-21 20:53  Kils  阅读(372)  评论(0编辑  收藏  举报