reader library for csv files.
Project description
Introduction
Welcome to my small python project.
This library just provides some functions to read from csv files.
I developed this library for fun.
If anyone wants to contribute, feel free to contact me or open an issue.
This library uses the built-in csv
module
Installation
Type this into your command prompt:
pip install csv-reader
Usage
at the top of your py files:
from csv_reader import Reader
in your code:
with Reader.openWithName("test.csv") as file:
for line in file:
print(line)
Documentation
Visit https://csv-reader.readthedocs.io/en/latest for the documentation.
Examples
The examples can also be found at https://csv-reader.readthedocs.io/en/latest/Examples.html
Reader
openWithName()
with Reader.openWithName("test.csv") as file:
for line in file:
print(line)
note: when used in a `for` loop, each `line` is a list of values in each line of the file.
openWithFile()
with Reader.openWithFile(open("test.csv" newline="")) as file:
for line in file:
print(line)
note: when used in a `for` loop, each `line` is a list of values in each line of the file.
readFromName()
with Reader.readFromName("test.csv") as file:
for line in file:
print(line)
note: `line` is a string.
readFromFile()
with Reader.readFromFile(open("test.csv", newline="")) as file:
for line in file:
print(line)
note: `line` is a string.
Writer
The Writer module provides 2 classes for writing to csv files. 1 uses lists while another uses dicts.
from csv_reader import Writer
csv_reader.CSVWriter
with CSVWriter("test.csv") as file:
file.write(["test1", "test2"])
csv_reader.CSVDictWriter
with CSVDictWriter("test.csv", ["field1", "field2"]) as file:
file.writeRows([
{"field1":"test1", "field2":"test2"},
{"field1": "test3", "field2": "test4"}
])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for csv_reader-2.0.0a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dabbf105dcf99415ddfaca8f5f3c58ad8048326fd81366866966d2fc4e6d6249 |
|
MD5 | bd1ac61db0b95f56773f9ea75fe72e2f |
|
BLAKE2b-256 | 798e459526bdc3dd3d3946f516b0b4c4a4d039463b652be36a4629c25b545887 |