items函数会将字典以数列形式返回,且元素是键值对应的元组。
d = {'one': 1, 'two': 2, 'three': 3}
print(d.items())
dict_items([('one', 1), ('two', 2), ('three', 3)])
有一个问题在于python3.0后还会输出dict_items()而不是单纯的数列
items函数会将字典以数列形式返回,且元素是键值对应的元组。
d = {'one': 1, 'two': 2, 'three': 3}
print(d.items())
dict_items([('one', 1), ('two', 2), ('three', 3)])
有一个问题在于python3.0后还会输出dict_items()而不是单纯的数列