Skip to main content
Latest Version https://travis-ci.org/ryanhiebert/backports.csv.svg?branch=master Join the chat at https://gitter.im/ryanhiebert/backports.csv

The API of the csv module in Python 2 is drastically different from the csv module in Python 3. This is due, for the most part, to the difference between str in Python 2 and Python 3.

The semantics of Python 3’s version are more useful because they support unicode natively, while Python 2’s csv does not.

Installation

pip install backports.csv

Usage

First make sure you’re starting your file off right:

from backports import csv

Then be careful with your files to handle the encoding. I suggest using io.TextIOWrapper, opening your file in binary mode, and declaring your desired encoding when constructing your TextIOWrapper.

from backports import csv
from io import TextIOWrapper

def read_csv(filename):
    with TextIOWrapper(open(filename, 'rb'), encoding='utf-8') as f:
        reader = csv.reader(f)
        for row in reader:
            yield row

def write_csv(filename, rows):
    with TextIOWrapper(open(filename, 'wb'), encoding='utf-8') as f:
        writer = csv.writer(f)
        for row in rows:
            writer.writerow(row)

License

This is a port of the csv module in the Python 3 standard libary. Because of this, backports.csv follows the same license as Python, whatever that may be at any given point in time.

1.0 (2016-02-11)

  • Initial Release

Metadata

Release files for backports.csv 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for backports.csv 1.0
File Size Uploaded
backports.csv-1.0.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for backports.csv 1.0
File Interpreter ABI Platform
backports.csv-1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 23.6 kB

Release files / backports.csv-1.0.tar.gz

Download URL backports.csv-1.0.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
074ff916d7e461f5d20ac742e5d7ded139ac37459add755c842473dbe5aa6b37
BLAKE2b-256 checksum
How to use checksums
2d0cedbca39513672ce6308aca8023d3fbef06e54e1c23485a79f1f1156738ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / backports.csv-1.0-py2.py3-none-any.whl

Download URL backports.csv-1.0-py2.py3-none-any.whl
Size 12.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2a071fe8d7d84e668295ab5f4314a4974310b10f9d4f7e0082187af3258991de
BLAKE2b-256 checksum
How to use checksums
cbfc75dd91487237003bf449f971dfea8ede4d564df4cca28de7df87c6026546
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

This release

1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page