summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorRĂ©mi Lapeyre <remi.lapeyre@henki.fr>2019-05-10 01:50:11 (GMT)
committerVictor Stinner <vstinner@redhat.com>2019-05-10 01:50:11 (GMT)
commitfce5ff1e18b522cf52379934a6560583d840e7f9 (patch)
tree89d1c624372e8840a1c843e4e78f16088e32df1a /Doc/library
parentd237b3f0f61990c972b84c45eb4fe137db51a6a7 (diff)
downloadcpython-fce5ff1e18b522cf52379934a6560583d840e7f9.zip
cpython-fce5ff1e18b522cf52379934a6560583d840e7f9.tar.gz
cpython-fce5ff1e18b522cf52379934a6560583d840e7f9.tar.bz2
bpo-27497: Add return value to csv.DictWriter.writeheader (GH-12306)
csv.DictWriter.writeheader() now returns the return value of the underlying csv.Writer.writerow() method. Patch contributed by Ashish Nitin Patil.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/csv.rst10
1 files changed, 8 insertions, 2 deletions
diff --git a/Doc/library/csv.rst b/Doc/library/csv.rst
index 17534fc..49e22fa 100644
--- a/Doc/library/csv.rst
+++ b/Doc/library/csv.rst
@@ -443,7 +443,8 @@ read CSV files (assuming they support complex numbers at all).
.. method:: csvwriter.writerow(row)
Write the *row* parameter to the writer's file object, formatted according to
- the current dialect.
+ the current dialect. Return the return value of the call to the *write* method
+ of the underlying file object.
.. versionchanged:: 3.5
Added support of arbitrary iterables.
@@ -467,9 +468,14 @@ DictWriter objects have the following public method:
.. method:: DictWriter.writeheader()
- Write a row with the field names (as specified in the constructor).
+ Write a row with the field names (as specified in the constructor) to
+ the writer's file object, formatted according to the current dialect. Return
+ the return value of the :meth:`csvwriter.writerow` call used internally.
.. versionadded:: 3.2
+ .. versionchanged:: 3.8
+ :meth:`writeheader` now also returns the value returned by
+ the :meth:`csvwriter.writerow` method it uses internally.
.. _csv-examples: