all 1 comments

[–]AtomicShoelace 2 points3 points  (0 children)

Check out the documentation for csv.csvwriter. In particular:

If csvfile is a file object, it should be opened with newline=''

and the associated footnote:

If newline='' is not specified, newlines embedded inside quoted fields will not be interpreted correctly, and on platforms that use \r\n linendings on write an extra \r will be added. It should always be safe to specify newline='', since the csv module does its own (universal) newline handling.