Module streamcsv.read
Low-level stream-based functions to parse CSV data.
Functions
| ufield (current, first, sep, consume) | Parses an un-quoted CSV field. |
| qfield (current, first, consume) | Parses a quoted CSV field. |
| field (current, first, sep, consume) | Parses any CSV field. |
| record (current, first, sep, consume) | Parses lines of CSV items. |
| file (current, first, sep, consume) | Parses entire CSV files. |
Functions
- ufield (current, first, sep, consume)
-
Parses an un-quoted CSV field.
Parameters:
- current string The (sub-)string that is currently being parsed
- first number The first unparsed index in current
- sep string Separator pair
- consume function A function that returns the next substring
Returns:
- The main result of the function
-
string
The current string snippet returned by
consume - number The next index to be parsed
- qfield (current, first, consume)
-
Parses a quoted CSV field.
Parameters:
- current string The (sub-)string that is currently being parsed
- first number The first unparsed index in current
- consume function A function that returns the next substring
Returns:
- The main result of the function
-
string
The current string snippet returned by
consume - number The next index to be parsed
- field (current, first, sep, consume)
-
Parses any CSV field.
Redirects to the correct field-parsing function depending on whether the
field starts with a quote.
Parameters:
- current string The (sub-)string that is currently being parsed
- first number The first unparsed index in current
- sep string Separator pair
- consume function A function that returns the next substring
Returns:
- The main result of the function
-
string
The current string snippet returned by
consume - number The next index to be parsed
- record (current, first, sep, consume)
-
Parses lines of CSV items.
Parameters:
- current string The (sub-)string that is currently being parsed
- first number The first unparsed index in current
- sep string Separator pair
- consume function A function that returns the next substring
Returns:
- The main result of the function
-
string
The current string snippet returned by
consume - number The next index to be parsed
- file (current, first, sep, consume)
-
Parses entire CSV files.
A “files” being a collection of recods, not in the sense of the Filesystem.
Parameters:
- current string The (sub-)string that is currently being parsed
- first number The first unparsed index in current
- sep string Separator pair
- consume function A function that returns the next substring
Returns:
- The main result of the function
-
string
The current string snippet returned by
consume - number The next index to be parsed