[Python-checkins] bpo-30937: Make usage of newline='' consistent in csv docs (GH-2730)

Berker Peksag webhook-mailer at python.org
Thu Oct 26 04:38:20 EDT 2017


https://github.com/python/cpython/commit/614ea48986f80d361043510ac3945f3dcd666c31
commit: 614ea48986f80d361043510ac3945f3dcd666c31
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Berker Peksag <berker.peksag at gmail.com>
date: 2017-10-26T11:38:14+03:00
summary:

bpo-30937: Make usage of newline='' consistent in csv docs (GH-2730)

(cherry picked from commit 275d2d9c4663a1ea8d1f7c8778567a735b0372c1)

files:
M Doc/library/csv.rst

diff --git a/Doc/library/csv.rst b/Doc/library/csv.rst
index 43714f74792..e1290d4c9b5 100644
--- a/Doc/library/csv.rst
+++ b/Doc/library/csv.rst
@@ -172,7 +172,7 @@ The :mod:`csv` module defines the following classes:
    A short usage example::
 
        >>> import csv
-       >>> with open('names.csv') as csvfile:
+       >>> with open('names.csv', newline='') as csvfile:
        ...     reader = csv.DictReader(csvfile)
        ...     for row in reader:
        ...         print(row['first_name'], row['last_name'])
@@ -211,7 +211,7 @@ The :mod:`csv` module defines the following classes:
 
        import csv
 
-       with open('names.csv', 'w') as csvfile:
+       with open('names.csv', 'w', newline='') as csvfile:
            fieldnames = ['first_name', 'last_name']
            writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
 
@@ -270,7 +270,7 @@ The :mod:`csv` module defines the following classes:
 
 An example for :class:`Sniffer` use::
 
-   with open('example.csv') as csvfile:
+   with open('example.csv', newline='') as csvfile:
        dialect = csv.Sniffer().sniff(csvfile.read(1024))
        csvfile.seek(0)
        reader = csv.reader(csvfile, dialect)



More information about the Python-checkins mailing list