8000 bpo-30937: Make usage of newline='' consistent in csv docs (GH-2730) · ultimatecoder/cpython@275d2d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 275d2d9

Browse files
ammaraskarberkerpeksag
authored andcommitted
bpo-30937: Make usage of newline='' consistent in csv docs (pythonGH-2730)
1 parent 41c5694 commit 275d2d9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Doc/library/csv.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ The :mod:`csv` module defines the following classes:
172172
A short usage example::
173173

174174
>>> import csv
175-
>>> with open('names.csv') as csvfile:
175+
>>> with open('names.csv', newline='') as csvfile:
176176
... reader = csv.DictReader(csvfile)
177177
... for row in reader:
178178
... print(row['first_name'], row['last_name'])
@@ -211,7 +211,7 @@ The :mod:`csv` module defines the following classes:
211211

212212
import csv
213213

214-
with open('names.csv', 'w') as csvfile:
214+
with open('names.csv', 'w', newline='') as csvfile:
215215
fieldnames = ['first_name', 'last_name']
216216
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
217217

@@ -270,7 +270,7 @@ The :mod:`csv` module defines the following classes:
270270

271271
An example for :class:`Sniffer` use::
272272

273-
with open('example.csv') as csvfile:
273+
with open('example.csv', newline='') as csvfile:
274274
dialect = csv.Sniffer().sniff(csvfile.read(1024))
275275
csvfile.seek(0)
276276
reader = csv.reader(csvfile, dialect)

0 commit comments

Comments
 (0)
0