On 18/11/19 9:30 am, Dave Cinege wrote:
The few times I looked at CSV module it never looked useful to me. I seem to use shlex for everything. For example:

def csv_split (s):
     lex = shlex.shlex(s, posix=True)
     lex.whitespace_split = True
     lex.whitespace = ','
     return list(lex)

That won't always work. CSV and sh are not quite the same
language. For example, Excel embeds quotes in quoted fields by
doubling them, whereas in sh you escape them with backslashes.

You can get away with it if you know your data doesn't contain
any of these cases, but generally it's easier and safer to
use the csv module for csv.

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

Reply via email to