Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdin/stdout with csv module #3

Open
e3krisztian opened this issue Dec 8, 2014 · 0 comments
Open

stdin/stdout with csv module #3

e3krisztian opened this issue Dec 8, 2014 · 0 comments
Labels

Comments

@e3krisztian
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant