docs: clarify csv.DictReader's treatment of the first data row (#118549)

This commit is contained in:
Ned Batchelder 2024-05-03 11:48:27 -04:00 committed by GitHub
parent 608192ee2f
commit 9d67b72a49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -156,8 +156,10 @@ The :mod:`csv` module defines the following classes:
The *fieldnames* parameter is a :term:`sequence`. If *fieldnames* is The *fieldnames* parameter is a :term:`sequence`. If *fieldnames* is
omitted, the values in the first row of file *f* will be used as the omitted, the values in the first row of file *f* will be used as the
fieldnames. Regardless of how the fieldnames are determined, the fieldnames and will be omitted from the results. If
dictionary preserves their original ordering. *fieldnames* is provided, they will be used and the first row will be
included in the results. Regardless of how the fieldnames are determined,
the dictionary preserves their original ordering.
If a row has more fields than fieldnames, the remaining data is put in a If a row has more fields than fieldnames, the remaining data is put in a
list and stored with the fieldname specified by *restkey* (which defaults list and stored with the fieldname specified by *restkey* (which defaults