Skip to main content

Convenience wrappers for the standard library csv module.

Project description

csvy

Basic context wrappers for stardard library csv.read and csv.write methods.

Writer Example

B

The writer returns a straight up csv.writer object:

import csvy

with csvy.writer('csvpath.csv') as csvfile:
    csvfile.writerow([1, 2, 3, 4])
Reader Example

The reader returns a proxy object that behaves a bit differently. You must call the iter method that yield an enumerator:

import csvy

with csvy.reader('csvpath.csv') as csvfile:
    for index, row in csvfile.iter():
        print(f"{index}: {row}")

If a header row is detected, the row object will be a namedtuple based on the values of the header line:

"""
src.csv:

A,B,C,column D
1,2,3,4
5,6,7,8

"""
import csvy

with csvy.reader('src.csv') as csvfile:
    for index, row in csvfile.iter():
        print(row.a)
        print(row.column_d)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for csvy, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size csvy-0.1.4-py3-none-any.whl (2.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size csvy-0.1.4.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page