numpy.who

numpy.who(vardict=None)[源代码]

打印给定词典中的NumPy数组。

如果没有传来词典或 vardict is None则返回globals()字典中的NumPy数组(命名空间中的所有NumPy数组)。

参数
vardict可选的

可能包含语法的词典。默认值为globals()。

返回
out没有

返回“None”。

笔记

打印出中所有数组的名称、形状、字节和类型 vardict .

实例

>>> a = np.arange(10)
>>> b = np.ones(20)
>>> np.who()
Name            Shape            Bytes            Type
===========================================================
a               10               80               int64
b               20               160              float64
Upper bound on total bytes  =       240
>>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str',
... 'idx':5}
>>> np.who(d)
Name            Shape            Bytes            Type
===========================================================
x               2                16               float64
y               3                24               float64
Upper bound on total bytes  =       40