Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
275d2d9c
Commit
275d2d9c
authored
Oct 26, 2017
by
Ammar Askar
Committed by
Berker Peksag
Oct 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-30937: Make usage of newline='' consistent in csv docs (GH-2730)
parent
41c56940
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Doc/library/csv.rst
Doc/library/csv.rst
+3
-3
No files found.
Doc/library/csv.rst
View file @
275d2d9c
...
@@ -172,7 +172,7 @@ The :mod:`csv` module defines the following classes:
...
@@ -172,7 +172,7 @@ The :mod:`csv` module defines the following classes:
A short usage example::
A short usage example::
>>> import csv
>>> import csv
>>> with open('names.csv') as csvfile:
>>> with open('names.csv'
, newline=''
) as csvfile:
... reader = csv.DictReader(csvfile)
... reader = csv.DictReader(csvfile)
... for row in reader:
... for row in reader:
... print(row['first_name'], row['last_name'])
... print(row['first_name'], row['last_name'])
...
@@ -211,7 +211,7 @@ The :mod:`csv` module defines the following classes:
...
@@ -211,7 +211,7 @@ The :mod:`csv` module defines the following classes:
import csv
import csv
with open('names.csv', 'w') as csvfile:
with open('names.csv', 'w'
, newline=''
) as csvfile:
fieldnames = ['first_name', 'last_name']
fieldnames = ['first_name', 'last_name']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
...
@@ -270,7 +270,7 @@ The :mod:`csv` module defines the following classes:
...
@@ -270,7 +270,7 @@ The :mod:`csv` module defines the following classes:
An example for :class:`Sniffer` use::
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))
dialect = csv.Sniffer().sniff(csvfile.read(1024))
csvfile.seek(0)
csvfile.seek(0)
reader = csv.reader(csvfile, dialect)
reader = csv.reader(csvfile, dialect)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment