zut.csv.CsvWriterFormat

class zut.csv.CsvWriterFormat(value)

Bases: Enum

Determine how CSV values are formatted. - PG, VISUAL and JSON are invariant of the locale. They all use , as the comma separator. They differ on the way they handle lists and dicts. - EXCEL tries to make the CSV file directly openable on Excel. It depends on the locale.

__init__(*args, **kwds)

Methods

parse(value)

Attributes

delimiter

PG

Export lists as PostgreSQL array literals and dicts as JSON.

VISUAL

Export lists and dicts as easily visuable strings when possible, otherwise as JSON.

JSON

Export lists and dicts as JSON.

EXCEL

Datetimes in local timezone, no microseconds, no scientific notation, visual lists and dicts.

EXCEL = 'X'

Datetimes in local timezone, no microseconds, no scientific notation, visual lists and dicts. CSV delimiter and decimal separator depend on the locale.

JSON = 'J'

Export lists and dicts as JSON.

PG = 'P'

Export lists as PostgreSQL array literals and dicts as JSON.

VISUAL = 'V'

Export lists and dicts as easily visuable strings when possible, otherwise as JSON.