frictionlessdata/tabulator-py

Proper way to define quote char?

cslovell opened this issue · 1 comments

How would you specify a custom character used to import strings that contain a delimiter?

For instance, if I set a hypothetical quotechar to the character |, I would expect the line |test|,|test1, test2|, |test3| to be imported as three strings: "test", "test1, test2", "test3".

This is where I'm hoping to insert the code:

with Stream(load_path, headers=1, quotechar="|") as stream:
     for row in stream.iter(keyed=True):
roll commented

Hi @cslovell,

This snippet works for me:

from tabulator import Stream

source = '|test1|,|test2.1,test2.2|,|test3|\n'
with Stream(source, scheme='text', format='csv', quotechar='|') as stream:
     print(stream.read())
    # [['test1', 'test2.1,test2.2', 'test3']]

Please re-open if it hasn't helped