字典

>>> a.items()
dict_items([('a', 1), ('b', 2)])
>>> for key in a.keys():
	print('key={}'.format(key))

	
key=a
key=b
>>> for value in a.values():
	print('values={}'.format(value))

	
values=1
values=2
>>> for key,value in a.items():
	print('{a}:{b}'.format(a=key,b=value))

	
a:1
b:2

  字典的遍历

 

posted @ 2019-08-13 11:24  月亮上的石头  阅读(77)  评论(0编辑  收藏  举报