https://github.com/f0903/csv_parsing
A basic CSV parser written in Python in less than a day for fun and learning purposes.
https://github.com/f0903/csv_parsing
csv csv-parser
Last synced: 5 months ago
JSON representation
A basic CSV parser written in Python in less than a day for fun and learning purposes.
- Host: GitHub
- URL: https://github.com/f0903/csv_parsing
- Owner: F0903
- Created: 2024-12-07T23:11:33.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-05T21:52:49.000Z (11 months ago)
- Last Synced: 2025-05-05T22:39:53.584Z (11 months ago)
- Topics: csv, csv-parser
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# csv_parsing
A basic CSV parser written in Python in less than a day for fun and learning purposes. Originally written for another project.
Obviously not recommended for use in any serious capacity.
## Usage
To use the parser, you can follow the example below:
```py
from .parsing.parser import CsvParser, BadLineMode
file = open("csv_file.csv", encoding="utf-8")
parser = CsvParser(
file,
BadLineMode.ERROR,
print_error_to=None,
allow_multiline_strings=True,
)
# parse() is a generator that parses a line and returns a CsvRow per iteration
for row in parser.parse():
# returns a CsvRow
value = row.get_value("column_name")
# Extracts string value from CsvRow
value_string = value.get_value()
```