5.4. Style

class pytablewriter.style.Style(**kwargs)[source]

Bases: object

Style specifier class for table elements.

Parameters:
  • align (str / pytablewriter.Align) –

    Text alignment specification for cells in a column. This can be only applied for text format writer classes. Possible values are:

    • "auto"/pytablewriter.Align.AUTO
      • Detect data type for each column and set alignment that appropriate for the type automatically
    • "left"/pytablewriter.Align.LEFT
    • "right"/pytablewriter.Align.RIGHT
    • "center"/pytablewriter.Align.CENTER
  • font_size (str / pytablewriter.style.FontSize) –

    Font size specification for cells in a column. This can be only applied for HTML/Latex writer classes. Possible values are:

    • "tiny"/pytablewriter.style.FontSize.TINY
    • "small"/pytablewriter.style.FontSize.SMALL
    • "medium"/pytablewriter.style.FontSize.MEDIUM
    • "large"/pytablewriter.style.FontSize.LARGE
    • pytablewriter.style.FontSize.NONE (no font size specification)
  • font_weight (str / pytablewriter.style.FontWeight) –

    Font weight specification for cells in a column. This can be only applied for HTML/Latex/Markdown writer classes. Possible values are:

    • "normal"/pytablewriter.style.FontWeight.NORMAL
    • "bold"/pytablewriter.style.FontWeight.BOLD
  • font_style (str / pytablewriter.style.FontStyle) –

    Font style specification for cells in a column. This can be applied only for HTML/Latex/Markdown writer classes. Possible values are:

    • "normal"/pytablewriter.style.FontStyle.NORMAL
    • "italic"/pytablewriter.style.FontStyle.ITALIC
  • thousand_separator (str / pytablewriter.style.ThousandSeparator) –

    Thousand separator specification for numbers in a column. This can be only applied for text format writer classes. Possible values are:

    • ","/"comma"/pytablewriter.style.ThousandSeparator.COMMA
    • " "/"space"/pytablewriter.style.ThousandSeparator.SPACE
    • ""/"none"/pytablewriter.style.ThousandSeparator.NONE

Example

Specify Cell Styles For Each Column