python - 打印表中的所有行

标签 python row

stat_data 列表有 323 个项目,我想打印到控制台:

from astropy.table import Table, Column
t = Table(rows=stat_data, names=('Redacted Term', 'Length', 'File', 'Type'))
print(t)

它没有打印所有行。帮我打印所有行:

Redacted Term Length             File              Type
------------- ------ ---------------------------- ------
Trump      5                       1.html  names
4909090909     10 otherfiles/sample-output.txt phones
3235294117     10 otherfiles/sample-output.txt phones
5957446808     10 otherfiles/sample-output.txt phones
8518518518     10 otherfiles/sample-output.txt phones
3255813953     10 otherfiles/sample-output.txt phones
5227272727     10 otherfiles/sample-output.txt phones
3076923076     10 otherfiles/sample-output.txt phones
0555555555     10 otherfiles/sample-output.txt phones
5384615384     10 otherfiles/sample-output.txt phones
4210526315     10 otherfiles/sample-output.txt phones
7777777777     10 otherfiles/sample-output.txt phones
3181818181     10 otherfiles/sample-output.txt phones
5869565217     10 otherfiles/sample-output.txt phones
1153846153     10 otherfiles/sample-output.txt phones
4347826086     10 otherfiles/sample-output.txt phones
2043010752     10 otherfiles/sample-output.txt phones
8260869565     10 otherfiles/sample-output.txt phones
6315789473     10 otherfiles/sample-output.txt phones
4583333333     10 otherfiles/sample-output.txt phones
  ...    ...                          ...    ...
William      7             otherfiles/a.txt  names
Mastrosimone     12             otherfiles/a.txt  names
William      7             otherfiles/a.txt  names
 Tell      4             otherfiles/a.txt  names
Oveture      7             otherfiles/a.txt  names
Gioachino      9             otherfiles/a.txt  names
Rossini      7             otherfiles/a.txt  names
Oklahoma      8             otherfiles/a.txt places
Sydney      6             otherfiles/a.txt places
Dallas      6             otherfiles/a.txt places
Texas      5             otherfiles/a.txt places
  San      3             otherfiles/a.txt places
Fransisco      9             otherfiles/a.txt places
  USA      3             otherfiles/a.txt places
Cupertino      9             otherfiles/a.txt places
Cupertino      9             otherfiles/a.txt places
   CA      2             otherfiles/a.txt places
Vinayak      7             otherfiles/2.txt  names
Sudhindra      9             otherfiles/3.txt  names
Sudhindra      9             otherfiles/3.txt  names
Length = 323 rows

最佳答案

pprint方法允许在不截断的情况下打印 astropy 表中的多行。例如,如果 blat是一个表格,您想要打印 100 行:

nlines = 100
blat.pprint(nlines) 

打印所有行:

nlines = len(blat) + 2
blat.pprint(nlines) 

其中 +2通常需要考虑标题行。

关于python - 打印表中的所有行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43555227/

相关文章:

python - selenium.common.exceptions.WebDriverException : Message: Service chromedriver unexpectedly exited. 状态代码为:1

c++ - 如何从二维数组中获取行和列 C++

html - 显示属性 - 表格、行、单元格 - 如何为现在显示为一行的每个 LI 的底部添加边框?

row - 你会如何正确放置盒子

python - 如何使用已经打开并使用登录凭据登录的浏览器

python - 交换不同行中的数字(来自文件输入库)而不使用临时变量

python - 通过数组值和数组值相关操作进行数组索引

python - 无需 OAuth 且只需 API key 即可获取 Youtube Analytics

R删除列表元素的行并保留行名

jquery - 在 jquery-datatables-editable 插件中添加行