Read: Import record data from an iterable using a layout¶
- class txf.Read(iterable[, source=None[, layout='csv'[, **config]]])¶
The
Readtransform pulls records from aniterableusing a particular layout. The output field names will be determined from the input or the config parameters.Readis the logical inverse ofWrite.- source: Transform or None¶
An optional input pipeline. New rows will be merged with the output of this pipeline.
- layout: str¶
The layout to generate the output in. Supported read layouts are:
csvComma-separated values. The header will be read to provide the field names.jsonJavaScript Object Notation records in array layout ([{..},...])jsonlJavaScript Object Notation Line layout ({...}\n{...}\n...)mdGitHub Markdown tables with headerstextTreats the file as a single field with a name taken fromconfig['default_fieldnames'].
- config: kwargs¶
Extra arguments to be passed to the layout object.
Usage¶
Read(p, sys.stdin 'csv')
Read(p, records, 'jsonl')