#字典元素的遍历(从字典中一次将元素进行获取)
#for i in scores: i是字典当中的键
# print(i)
######################################################
scores={'张三':100,'李四':98,'王五':45}
for i in scores:#i是字典当中的键,获取的是字典当中的键
print(i,end='\t')
print()
for i in scores:
print(scores[i],end='\t')
print()
for i in scores:
print(scores.get(i),end='\t')
print()
Python入门--字典元素的遍历for-in
于 2022-02-11 00:08:19 首次发布