Python中遍历字典中所有的key和value值

客官°小女子只卖身不卖艺 2022-11-15 01:27 367阅读 0赞

aa=[“xuhaitao”,”xuhaihuan”,”xuhairu”,”lidaiping”]
cc={“ba”:”xuguozhu123”,”ma”:”lidaiping”,33:”xuhaitao33434”}

#遍历字典所有key值
for c in cc.keys():
print(c)
#遍历字典所有key值另一种写法
for c in cc:
print(c)
#遍历字典中所有values值
for c in cc.values():
print(c)
#遍历字典中所有values值另一种写法
for c in cc:
print(cc[c])

发表评论

表情:
评论列表 (有 0 条评论,367人围观)

还没有评论,来说两句吧...

相关阅读