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.
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=''alsonext(csvfile)should return strings (= unicode)They seem to work fine with
sys.stdin,sys.stdouton linux, but it might be an accident.Note:
csv.reader(sys.stdin)is quote common usage.