numpy.lib.Arrayterator.flat¶
-
Arrayterator.
flat
¶ Arrayterator对象的1-D平面迭代器。
此迭代器返回要在
Arrayterator
中迭代的数组的元素。它类似于flatiter。也可以看看
Arrayterator
,flatiter
例子
>>> a = np.arange(3 * 4 * 5 * 6).reshape(3, 4, 5, 6) >>> a_itor = np.lib.Arrayterator(a, 2)
>>> for subarr in a_itor.flat: ... if not subarr: ... print(subarr, type(subarr)) ... 0 <type 'numpy.int32'>