On 11/17/19 7:18 AM, Antoon Pardon wrote:
This is python 2.6->2.7 and 3.5->3.7

I need to convert a string that is a csv line to a list and vice versa.
I thought to find functions doing this in the csv module but that doesn't
seem to be the case.

I can of course write special classes that would allow for this using
a csv.reader and csv.writer but that would be some convoluted code.

Anyone some suggestions?

Wrap your string in a list; csv.reader takes an iterator:

    s = "some, string, with, commas"
    r = csv.reader([s])
    for x in r:
        print x

Dan

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to