csv: No fields, or one field?
Kiuhnm
kiuhnm03.4t.yahoo.it
Wed Apr 25 14:36:44 EDT 2012
On 4/25/2012 20:05, Neil Cerutti wrote:
> Is there an explanation or previous dicussion somewhere for the
> following behavior? I haven't yet trolled the csv mailing list
> archive, though that would probably be a good place to check.
>
> Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit
> (Intel)] on win 32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import csv
>>>> next(csv.reader(['""\r\n']))
> ['']
>>>> next(csv.reader(['\r\n']))
> []
This should be documented (I trust you when you say it isn't), but it
makes a lot of sense:
>>> next(csv.reader(['']))
[]
>>> next(csv.reader(['""']))
['']
>>> next(csv.reader([',']))
['', '']
>>> next(csv.reader([',,']))
['', '', '']
...
Kiuhnm
More information about the Python-list
mailing list