Line

class Line(fields: List[Field], values: List[Any] | None = None, delimiter: str | bytes | None = None, storage: str = '')[source]

Class for representing a generic line that is composed of fields and can be read from or written to a file.

read(line: str | bytes) List[Any][source]

Reads a line for extracting information following the given fields.

Parameters:

line (str | bytes) – The line to be read

Returns:

The extracted values, in order

Return type:

List[Any]

write(values: List[Any]) str | bytes[source]

Writes to a line with the existing information in the given fields.

Parameters:

values – The value of the fields to be written

Returns:

The line with the new field information

Return type:

str | bytes