Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
9188702a
Kaydet (Commit)
9188702a
authored
Mar 20, 2011
tarafından
R David Murray
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#7198: add newlines='' to csv.writer docs.
üst
72bd8b7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
27 deletions
+11
-27
csv.rst
Doc/library/csv.rst
+11
-10
README
Tools/demo/README
+0
-17
No files found.
Doc/library/csv.rst
Dosyayı görüntüle @
9188702a
...
...
@@ -52,7 +52,7 @@ The :mod:`csv` module defines the following functions:
*csvfile* can be any object which supports the :term:`iterator` protocol and returns a
string each time its :meth:`!__next__` method is called --- :term:`file objects
<file object>` and list objects are both suitable. If *csvfile* is a file object,
it should be opened with ``newline=''``. [
#
]_ An optional
it should be opened with ``newline=''``. [
1
]_ An optional
*dialect* parameter can be given which is used to define a set of parameters
specific to a particular CSV dialect. It may be an instance of a subclass of
the :class:`Dialect` class or one of the strings returned by the
...
...
@@ -79,7 +79,8 @@ The :mod:`csv` module defines the following functions:
Return a writer object responsible for converting the user's data into delimited
strings on the given file-like object. *csvfile* can be any object with a
:func:`write` method. An optional *dialect*
:func:`write` method. If csvfile is a file object, it should be opened with
newline='' [1]_. An optional *dialect*
parameter can be given which is used to define a set of parameters specific to a
particular CSV dialect. It may be an instance of a subclass of the
:class:`Dialect` class or one of the strings returned by the
...
...
@@ -96,7 +97,7 @@ The :mod:`csv` module defines the following functions:
A short usage example::
>>> import csv
>>> spamWriter = csv.writer(open('eggs.csv', 'w'), delimiter=' ',
>>> spamWriter = csv.writer(open('eggs.csv', 'w'
, newline=''
), delimiter=' ',
... quotechar='|', quoting=csv.QUOTE_MINIMAL)
>>> spamWriter.writerow(['Spam'] * 5 + ['Baked Beans'])
>>> spamWriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
...
...
@@ -427,7 +428,7 @@ The simplest example of reading a CSV file::
Reading a file with an alternate format::
import csv
with open('passwd') as f:
with open('passwd'
, newline=''
) as f:
reader = csv.reader(f, delimiter=':', quoting=csv.QUOTE_NONE)
for row in reader:
print(row)
...
...
@@ -435,7 +436,7 @@ Reading a file with an alternate format::
The corresponding simplest possible writing example is::
import csv
with open('some.csv', 'w') as f:
with open('some.csv', 'w'
, newline=''
) as f:
writer = csv.writer(f)
writer.writerows(someiterable)
...
...
@@ -457,7 +458,7 @@ Registering a new dialect::
import csv
csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)
with open('passwd') as f:
with open('passwd'
, newline=''
) as f:
reader = csv.reader(f, 'unixpwd')
A slightly more advanced use of the reader --- catching and reporting errors::
...
...
@@ -482,7 +483,7 @@ done::
.. rubric:: Footnotes
.. [
#
] If ``newline=''`` is not specified, newlines embedded inside quoted fields
will not be interpreted correctly
. It should always be safe to specify
``newline=''``, since the csv module does its own universal newline handling
on input
.
.. [
1
] If ``newline=''`` is not specified, newlines embedded inside quoted fields
will not be interpreted correctly
, and on platforms that use ``\r\n`` linendings
on write an extra `\\r` will be added. It should always be safe to specify
``newline=''``, since the csv module does its own (universal) newline handling
.
Tools/demo/README
deleted
100644 → 0
Dosyayı görüntüle @
72bd8b7b
This directory contains a collection of demonstration scripts for
various aspects of Python programming.
beer.py Well-known programming example: Bottles of beer.
eiffel.py Python advanced magic: A metaclass for Eiffel post/preconditions.
hanoi.py Well-known programming example: Towers of Hanoi.
life.py Curses programming: Simple game-of-life.
markov.py Algorithms: Markov chain simulation.
mcast.py Network programming: Send and receive UDP multicast packets.
queens.py Well-known programming example: N-Queens problem.
redemo.py Regular Expressions: GUI script to test regexes.
rpython.py Network programming: Small client for remote code execution.
rpythond.py Network programming: Small server for remote code execution.
sortvisu.py GUI programming: Visualization of different sort algorithms.
ss1.py GUI/Application programming: A simple spreadsheet application.
vector.py Python basics: A vector class with demonstrating special methods.
\ No newline at end of file
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