Python打印"..."以非常大的输出 [英] Python prints "..." in very large output

查看:63
本文介绍了Python打印"..."以非常大的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在python中打印一些大的东西,而不是得到全部结果,我得到了中间带有"..."的部分.有什么想法可以得到全部吗?

例如

'8.881386032' '5.737972827' '3.355746972' ..., '2.827335059', '2.598858336' '2.69954686'

代码是:

 transposedMatrix = np.transpose(data)
 print (transposedMatrix)

我已经将其转换为字符串,并且在写入文件时得到相同的结果

解决方案

对于numpy,请致电:

import sys
import numpy

numpy.set_printoptions(threshold=sys.maxint)

将阈值提高到无穷大.有关更多详细信息,请参见 numpy.set_printoptions()文档. /p>

对于Python 3,请改用sys.maxsize:

numpy.set_printoptions(threshold=sys.maxsize)

I am trying to print something big in python and instead of getting the whole result i get parts of it with "..." in the middle. Any ideas how to get the whole of it?

e.g.

'8.881386032' '5.737972827' '3.355746972' ..., '2.827335059', '2.598858336' '2.69954686'

The code is:

 transposedMatrix = np.transpose(data)
 print (transposedMatrix)

I am already converting it into a string and i get the same thing when i am writing in files

解决方案

For numpy, call:

import sys
import numpy

numpy.set_printoptions(threshold=sys.maxint)

to raise the threshold to infinity. See the numpy.set_printoptions() documentation for more details.

For Python 3, use sys.maxsize instead:

numpy.set_printoptions(threshold=sys.maxsize)

这篇关于Python打印"..."以非常大的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆