alan-turing-institute/CleverCSV

reading single csv line which containing multiple lines in content malfunctioned

Closed this issue · 3 comments

For example I got a csv file which looks like:

header1,header2
"this
is
content","
another
content
"

apart from headers, the returned data from stream_table may looks like:

['"this', 'is']

This is caused by the implementation of stream_table, and It got be fixed

Is there anyone taking a look?
@GjjvdBurg

Hi, @Dobiichi-Origami. It appears that you are not providing the quote character in the dialect used to read the CSV file.

@Dobiichi-Origami Thanks for raising this issue, unfortunately I can't reproduce it on my end:

$ cat -p /tmp/test.csv
header1,header2
"this
is
content","
another
content
"

$ python
>>> from clevercsv import stream_table
>>> rows = list(stream_table('/tmp/test.csv'))
>>> rows
[['header1', 'header2'], ['this\nis\ncontent', '\nanother\ncontent\n']]

which suggests the data is loaded correctly. Feel free to reopen this issue if this isn't the case on your end.