空字典
empty = {}
字典遍历
- 遍历所有键
calorie = {'apple': 54, 'orange': 44, 'banana': 93}
for key in calorie.keys():
print(key)
- 遍历所有值
calorie = {'apple': 54, 'orange': 44, 'banana': 93}
for value in calorie.values():
print(value)
- 遍历所有键值对
calorie = {'apple': 54, 'orange': 44, 'banana': 93}
for key, value in calorie.items():
print(key, value)