write

astropy.io.ascii.write(table, output=None, format=None, Writer=None, fast_writer=True, \*, overwrite=None, \*\*kwargs)[source]

Write the input table to filename. Most of the default behavior for various parameters is determined by the Writer class.

See also:

Parameters
tableBaseReader, array_like, str, file_like, list

Input table as a Reader object, Numpy struct array, file name, file-like object, list of strings, or single newline-separated string.

outputstr, file_like

Output [filename, file-like object]. Defaults to``sys.stdout``.

formatstr

Output table format. Defaults to ‘basic’.

delimiterstr

Column delimiter string

commentstr, bool

String defining a comment line in table. If False then comments are not written out.

quotecharstr

One-character string to quote fields containing special characters

formatsdict

Dictionary of format specifiers or formatting functions

strip_whitespacebool

Strip surrounding whitespace from column values.

nameslist

List of names corresponding to each data column

include_nameslist

List of names to include in output.

exclude_nameslist

List of names to exclude from output (applied after include_names)

fast_writerbool, str

Whether to use the fast Cython writer. Can be True (use fast writer if available), False (do not use fast writer), or 'force' (use fast writer and fail if not available, mostly for testing).

overwritebool

If overwrite=None (default) and the file exists, then a warning will be issued. In a future release this will instead generate an exception. If overwrite=False and the file exists, then an exception is raised. This parameter is ignored when the output arg is not a string (e.g., a file object).