[issue32919] csv.reader() to support QUOTE_ALL

Pavel Shpilev report at bugs.python.org
Mon Mar 5 19:42:52 EST 2018


Pavel Shpilev <p.shpilev at gmail.com> added the comment:

I know that CSV specification says empty field and empty string are the same, however, I still believe there is practical use for unconventional processing of such fields.

In our specific case we parse CSVs produced by Amazon Athena (based on Presto) in which NULL and empty string values represented as above. Following CSV specs dogmatically, there's no way to distinguish between the two, but pragmatically you can tell them apart by simply looking at values.

Brief search shows we aren't the only ones facing the issue. After giving it some more thought, I'd agree that csv.QUOTE_ALL doesn't make much sense here, but may be an extra argument to csv.reader() will do the trick? Something like csv.reader(detect_none_values=False/True), with False being default, and emphasis in the documentation that True goes against CSV specification.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32919>
_______________________________________


More information about the Python-bugs-list mailing list