Skip Montanaro <s...@pobox.com> added the comment: > If the documentation is not clear enough about requiring binary, it is > a doc bug.
The documentation for both csv.reader and csv.writer state (this is from the Python 2.7 version): If *csvfile* is a file object, it must be opened with the 'b' flag on platforms where that makes a difference. I suppose we could be explicit and mention Windows here, but the wording is quite clear. There is really no harm in always opening the file in binary mode, and I do that myself even though I only program on Unix or Mac platforms where it's safe to open the file in text mode. This all changed in Python 3. There, the choice of line ending is up to the programmer, so file objects for use by the csv module are opened with newline='' and when writing CSV data the writer object takes complete control of proper line termination according to the programmer's stated choice of lineterminator. Skip ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7198> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com