numpy.lib.Arrayterator.flat

原文:https://docs.scipy.org/doc/numpy/reference/generated/numpy.lib.Arrayterator.flat.html

译者:飞龙 UsyiyiCN

校对:(虚位以待)

Arrayterator.flat

Arrayterator对象的1-D平面迭代器。

此迭代器返回要在Arrayterator中迭代的数组的元素。它类似于flatiter

也可以看看

Arrayteratorflatiter

例子

>>> 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'>