astropy:docs

HTML

class astropy.io.ascii.HTML(htmldict={})[source] [edit on github]

Bases: astropy.io.ascii.BaseReader

Read and write HTML tables.

In order to customize input and output, a dict of parameters may be passed to this class holding specific customizations.

htmldict : Dictionary of parameters for HTML input/output.

  • css : Customized styling

    If present, this parameter will be included in a <style> tag and will define stylistic attributes of the output.

  • table_id : ID for the input table

    If a string, this defines the HTML id of the table to be processed. If an integer, this specifies the index of the input table in the available tables. Unless this parameter is given, the reader will use the first table found in the input file.

  • multicol : Use multi-dimensional columns for output

    The writer will output tuples as elements of multi-dimensional columns if this parameter is true, and if not then it will use the syntax 1.36583e-13 .. 1.36583e-13 for output. If not present, this parameter will be true by default.

  • parser : Specific HTML parsing library to use

    If specified, this specifies which HTML parsing library BeautifulSoup should use as a backend. The options to choose from are ‘html.parser’ (the standard library parser), ‘lxml’ (the recommended parser), ‘xml’ (lxml’s XML parser), and ‘html5lib’. html5lib is a highly lenient parser and therefore might work correctly for unusual input if a different parser fails.

  • jsfiles : list of js files to include when writing table.

  • cssfiles : list of css files to include when writing table.

  • js : js script to include in the body when writing table.

Initialize classes for HTML reading and writing.

Methods Summary

read(table) Read the table in HTML format and return a resulting Table.
write(table) Return data in table converted to HTML as a list of strings.

Methods Documentation

read(table)[source] [edit on github]

Read the table in HTML format and return a resulting Table.

write(table)[source] [edit on github]

Return data in table converted to HTML as a list of strings.

Page Contents