sh_12_字典的遍历

 

sh_12_字典的遍历

xiaoming_dict = {"name": "小明",
                 "qq": "123456",
                 "phone": "10086"}

# 迭代遍历字典
# 变量k是每一次循环中,获取到的键值对的key
for k in xiaoming_dict:

    print("%s - %s" % (k, xiaoming_dict[k]))

 

posted @ 2019-09-14 15:59  俊豪郎  阅读(162)  评论(0编辑  收藏  举报