【发布时间】:2013-08-13 13:08:46
【问题描述】:
>>> d = {'m': 'mango', 'f': 'fish', 'a': 'apple'}
>>> d
{'m': 'mango', 'f': 'fish', 'a': 'apple'}
>>> d.keys()
dict_keys(['m', 'f', 'a'])
>>> for x in d.keys(): print(x)
m
f
a
>>> |
什么是dict_keys() 以及如何在方法中覆盖它(__iter__ 的方式
被覆盖)?
【问题讨论】:
标签: python python-3.x dictionary generator