fruit_dict={"a":"apple","b":"banana","o":"orange"}
print '=============items()遍历==============='
for key,value in fruit_dict.items():
print key,value
print '=============iteritems()遍历==============='
for key,value in fruit_dict.iteritems():
print key,value
print '=============keys()遍历==============='
for key in fruit_dict.keys():
print key,fruit_dict[key]
print '=============values()遍历==============='
for value in fruit_dict.values():
print value
print '=============itervalues()遍历==============='
for value in fruit_dict.itervalues():
print value
python遍历字典的方法
最新推荐文章于 2024-02-27 11:33:35 发布