Read: Import record data from an iterable using a layout¶
- class txf.Read(iterable[, source=None[, layout='csv'[, **config]]])¶
The
Read
transform pulls records from aniterable
using a particular layout. The output field names will be determined from the input or the config parameters.Read
is 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:
csv
Comma-separated values. The header will be read to provide the field names.json
JavaScript Object Notation records in array layout ([{..},...]
)jsonl
JavaScript Object Notation Line layout ({...}\n{...}\n...
)md
GitHub Markdown tables with headerstext
Treats 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')