[docs] Add doc examples for DictReader and DictWriter (issue 20351)

vadmium+py at gmail.com vadmium+py at gmail.com
Thu Apr 17 09:03:48 CEST 2014


https://bugs.python.org/review/20351/diff/11072/Doc/library/csv.rst
File Doc/library/csv.rst (right):

https://bugs.python.org/review/20351/diff/11072/Doc/library/csv.rst#newcode161
Doc/library/csv.rst:161: ...     reader = csv.DictReader(csvfile)
I did a quick test of this code on Arch Linux with Python 3.4, and it
worked as advertised. The column names are documented to be taken from
the first row if you omit “fieldnames”, so where did your first row go?

https://bugs.python.org/review/20351/diff/11072/Doc/library/csv.rst#newcode163
Doc/library/csv.rst:163: ...         print(row['first_name'],
row['last_name'].upper())
I think the upper() call is more of a distraction than an illustration;
I suggest just
    print(row['first_name'], row['last_name'])

https://bugs.python.org/review/20351/


More information about the docs mailing list