Kaydet (Commit) 275d2d9c authored tarafından Ammar Askar's avatar Ammar Askar Kaydeden (comit) Berker Peksag

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

üst 41c56940
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment