标签:dict code int nbsp src 数据 close 迭代器 __iter__
只要是能被for循环的数据类型就一定拥有_iter_方法
例如:
print(‘__iter__‘ in dir(int)) print(‘__iter__‘ in dir(bool)) print(‘__iter__‘ in dir(list)) print(‘__iter__‘ in dir(dict)) print(‘__iter__‘ in dir(set)) print(‘__iter__‘ in dir(tuple)) print(‘__iter__‘ in dir(enumerate([]))) print(‘__iter__‘ in dir(range(1)))
标签:dict code int nbsp src 数据 close 迭代器 __iter__
原文地址:https://www.cnblogs.com/zly9527/p/11343261.html