Skip to content

stdin/stdout with csv module #3

@e3krisztian

Description

@e3krisztian

The csv modules of 2.x and 3.x differ significantly on what type of file they expect - and how it is opened.

Python 2.x: If csvfile is a file object, it must be opened with the ‘b’ flag on platforms where that makes a difference.
Python 3.x: If csvfile is a file object, it should be opened with newline='' also next(csvfile) should return strings (= unicode)

They seem to work fine with sys.stdin, sys.stdout on linux, but it might be an accident.

Note: csv.reader(sys.stdin) is quote common usage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions