RST#
- class astropy.io.ascii.RST(header_rows=None)[源代码]#
基类:
FixedWidth
reStructuredText简单格式表。
参见:https://docutils.sourceforge.io/docs/ref/rst/restructedText.htmlsimple-表格
例子::
>>> from astropy.table import QTable >>> import astropy.units as u >>> import sys >>> tbl = QTable({"wave": [350, 950] * u.nm, "response": [0.7, 1.2] * u.count}) >>> tbl.write(sys.stdout, format="ascii.rst") ===== ======== wave response ===== ======== 350.0 0.7 950.0 1.2 ===== ========
与其他固定宽度格式一样,在编写表格时,您可以提供
header_rows
若要指定要作为标题输出的表行列表,请执行以下操作。例如::>>> tbl.write(sys.stdout, format="ascii.rst", header_rows=['name', 'unit']) ===== ======== wave response nm ct ===== ======== 350.0 0.7 950.0 1.2 ===== ========
目前不支持读取使用连续行的表,也不支持通过在页眉中使用另一行破折号来定义列跨距的表。
方法总结
read
\(表)阅读
table
并以由确定的格式返回结果outputter
属性。write
\(行)写
table
作为字符串列表。方法文件