📜  字典获取键和值. - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:44.606000             🧑  作者: Mango

代码示例2
# Loop thru a dictionary, get both key and value.

dd = {'john':3, 'mary':4, 'joe':5, 'vicky':7}

for kk, vv in dd.items():
    print(kk, ' is ', vv)

# john  is  3
# mary  is  4
# joe  is  5
# vicky  is  7