我在python中处理图像处理,我想输出一个变量,现在变量b
是一个具有形状(200,200)
的numpy数组。当我做print b
时,我看到的是:
array([[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.],
...,
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.]])
如何打印出这个数组的全部内容,将其写入一个文件或一些简单的东西,以便我可以查看完整的内容?
当然,可以使用以下命令将数组的打印阈值更改为answered elsewhere:
但根据你想看的东西,也许有更好的方法。例如,如果您的数组如您所示大部分为零,并且您想检查它是否有非零的值,您可以查看如下内容:
更改某些值:
看起来还是一样的:
检查一些不需要手动查看所有值的内容:
或者策划:
或保存到文件:
如果是numpy数组:Print the full numpy array
相关问题 更多 >
编程相关推荐