5.3. Table Format

class pytablewriter.FormatAttr[source]

Bitmaps to represent table attributes.

API = 64

Can call API for external service.

BIN = 16

Table format that can represent as a binary file.

FILE = 4

Can create a file with the format.

SOURCECODE = 32

Can create a source code (variables definition) one of the programming language.

TEXT = 8

Table format that can represent as a text.

class pytablewriter.TableFormat(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Enum to represent table format attributes.

classmethod find_all_attr(format_attribute: int) List[TableFormat][source]

Searching table formats that have specific attributes.

Parameters:

format_attribute (FormatAttr) – Table format attributes to look for.

Returns:

Table formats that matched the attribute.

Return type:

List[TableFormat]

classmethod from_name(format_name: str) TableFormat | None[source]

Get a table format from a format name.

Parameters:

format_name (str) – Table format specifier.

Returns:

A table format enum value corresponding to the format_name.

Return type:

Optional[TableFormat]

property file_extensions: List[str]

File extensions associated with the table format.

Type:

List[str]

classmethod find_all_attr(format_attribute: int) List[TableFormat][source]

Searching table formats that have specific attributes.

Parameters:

format_attribute (FormatAttr) – Table format attributes to look for.

Returns:

Table formats that matched the attribute.

Return type:

List[TableFormat]

property format_attribute: int

Table attributes bitmap.

Type:

FormatAttr

classmethod from_file_extension(file_extension: str) TableFormat | None[source]

Get a table format from a file extension.

Parameters:

file_extension (str) – File extension.

Returns:

A table format enum value corresponding to the file_extension.

Return type:

Optional[TableFormat]

classmethod from_name(format_name: str) TableFormat | None[source]

Get a table format from a format name.

Parameters:

format_name (str) – Table format specifier.

Returns:

A table format enum value corresponding to the format_name.

Return type:

Optional[TableFormat]

property names: List[str]

Names associated with the table format.

Type:

List[str]

property writer_class: AbstractTableWriter

Table writer class object associated with the table format.

Type:

Type[AbstractTableWriter]