New submission from Stefan Vasilev <[email protected]>:
import csv
csv.writer(open('./file.csv', 'a', newline='')).writerow(['ID', 0])
If you try to open file.csv with Excel on Windows 10 it says:
The file format and extension of 'file.csv' don't match. The file could be
corrupted or unsafe. Unless you trust its source don't open it. Do you want to
open it anyway.
When you click 'Yes', another msgbox appears saying:
Excel has detected that 'file.csv' is a SYLK file, but cannot load it. Either
the file has errors or it is not a SYLK fyle format. Click OK to try to open
the file in a different format.
When you click on 'OK' it opens it as expected.
The strange thing is that if you use the following code, there are no problems
opening it:
import csv
csv.writer(open('./file.csv', 'a', newline='')).writerow(['Id', 0])
----------
components: Windows
messages: 319378
nosy: Stefan Vasilev, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Writing capital letters with csvwriter.writerow changes the csv file
format
type: behavior
versions: Python 3.5
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue33844>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com