1. 程式人生 > >Python學習之路-字典外傳

Python學習之路-字典外傳

pan span dict 學習之路 keys color pytho dex int

__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‘] [‘蒼井空‘, ‘京香‘, ‘波多野結衣‘, ‘小澤瑪利亞‘, ‘上原瑞惠‘, ‘櫻井莉亞‘, ‘桃谷繪裏香‘]

Python學習之路-字典外傳