Fixed-width reader¶
Agate contains a fixed-width file reader that is designed to work like Python’s csv
.
These readers work with CSV-formatted schemas, such as those maintained at wireservice/ffs.
agate.fixed.reader |
A wrapper around fixed.Reader , so that it can be used in the same way as a normal CSV reader. |
agate.fixed.Reader |
Reads a fixed-width file using a column schema in CSV format. |
agate.fixed.DictReader |
A fixed-width reader that returns collections.OrderedDict rather than a list. |
Detailed list¶
-
agate.fixed.
reader
(*args, **kwargs)¶ A wrapper around
fixed.Reader
, so that it can be used in the same way as a normal CSV reader.
-
class
agate.fixed.
Reader
(f, schema_f)¶ Bases:
six.Iterator
Reads a fixed-width file using a column schema in CSV format.
This works almost exactly like Python’s built-in CSV reader.
Schemas must be in the “ffs” format, with
column
,start
, andlength
columns. There is a repository of such schemas maintained at wireservice/ffs.-
fieldnames
¶ The names of the columns read from the schema.
-
-
class
agate.fixed.
DictReader
(f, schema_f)¶ Bases:
agate.fixed.Reader
A fixed-width reader that returns
collections.OrderedDict
rather than a list.