简述
Python字典.items()可以返回字典中可遍历的(键,值)元组数组.
例子
my_dict = {}
c = my_dict.items()
print(c)
my_dict = {'a': 'ssdfsdf', 'sdf': 'sdfwefwef'}
c = my_dict.items()
print(c)
for a, b in c:
print(a, b)
输出:
'''
dict_items([])
dict_items([('a', 'ssdfsdf'), ('sdf', 'sdfwefwef')])
a ssdfsdf
sdf sdfwefwef
'''