3 ms·
That's not what Python and Google Sheets do. >>> list(csv.reader(['''AA"A,"AA""A","A"A"A'''], dialect='excel')) [['AA"A', 'AA"A', 'AA"A']] Has the CSV
by jart 5y ago
That's not what Python and Google Sheets do.
>>> list(csv.reader(['''AA"A,"AA""A","A"A"A'''], dialect='excel'))
[['AA"A', 'AA"A', 'AA"A']]
Has the CSV format been standardized somewhere?
- mattewong 5y agoWhat I can tell you is that if you save a file with 'AA"A,"AA""A","A"A"A' (excluding the surrounding single-quotes) and then double-click to open in Excel, you get 3 cells with the exact same values. Furthermore, if you run `echo 'AA"A,"AA""A","A"A"A' | xsv select 1,2,3` you again get the same 3 values. For people working with CSV, it's far more likely that the user cares more about consistency with Excel than consistency with some python lib or with Google sheets-- neither of which are used much, compared to Excel, in the worlds where CSV tends to reside (at least in my experience)
- mattewong 5y agoHuh? your comment proves exactly what my prior post said, which is that you end up with 3 equal values that were each represented, in the input, in different ways. Looks like csv.reader + dialect=excel is doing exactly that.