RST#
- class astropy.io.ascii.RST(header_rows=None)[source]#
 Bases:
FixedWidthreStructuredText simple format table.
See: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#simple-tables
Example:
>>> 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 ===== ========
Like other fixed-width formats, when writing a table you can provide
header_rowsto specify a list of table rows to output as the header. For example:>>> tbl.write(sys.stdout, format="ascii.rst", header_rows=['name', 'unit']) ===== ======== wave response nm ct ===== ======== 350.0 0.7 950.0 1.2 ===== ========
Currently there is no support for reading tables which utilize continuation lines, or for ones which define column spans through the use of an additional line of dashes in the header.
Methods Summary
read(table)Read the
tableand return the results in a format determined by theoutputterattribute.write(lines)Write
tableas list of strings.Methods Documentation
- read(table)[source]#
 Read the
tableand return the results in a format determined by theoutputterattribute.The
tableparameter is any string or object that can be processed by the instanceinputter. For the base Inputter classtablecan be one of:File name
File-like object
String (newline separated) with all header and data lines (must have at least 2 lines)
List of strings
- Parameters:
 - table
python:str, python:file-like object,python:list Input table.
- table
 - Returns:
 - table
Table Output table
- table