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
bd5279ea
Kaydet (Commit)
bd5279ea
authored
Ara 08, 2012
tarafından
Andrew Svetlov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Drop double newlines printed in some file iteration examples.
Patch by Steven Kryskalla.
üst
b7bc9253
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
6 deletions
+7
-6
stdtypes.rst
Doc/library/stdtypes.rst
+3
-3
classes.rst
Doc/tutorial/classes.rst
+1
-1
errors.rst
Doc/tutorial/errors.rst
+2
-2
ACKS
Misc/ACKS
+1
-0
No files found.
Doc/library/stdtypes.rst
Dosyayı görüntüle @
bd5279ea
...
...
@@ -2330,7 +2330,7 @@ Files have the following methods:
with open("hello.txt") as f:
for line in f:
print line
print line
,
In older versions of Python, you would have needed to do this to get the same
effect::
...
...
@@ -2338,7 +2338,7 @@ Files have the following methods:
f = open("hello.txt")
try:
for line in f:
print line
print line
,
finally:
f.close()
...
...
@@ -2392,7 +2392,7 @@ Files have the following methods:
A file object is its own iterator, for example ``iter(f)`` returns *f* (unless
*f* is closed). When a file is used as an iterator, typically in a
:keyword:`for` loop (for example, ``for line in f: print line``), the
:keyword:`for` loop (for example, ``for line in f: print line
.strip()
``), the
:meth:`~file.next` method is called repeatedly. This method returns the next input
line, or raises :exc:`StopIteration` when EOF is hit when the file is open for
reading (behavior is undefined when the file is open for writing). In order to
...
...
Doc/tutorial/classes.rst
Dosyayı görüntüle @
bd5279ea
...
...
@@ -688,7 +688,7 @@ using a :keyword:`for` statement::
for char in "123":
print char
for line in open("myfile.txt"):
print line
print line
,
This style of access is clear, concise, and convenient. The use of iterators
pervades and unifies Python. Behind the scenes, the :keyword:`for` statement
...
...
Doc/tutorial/errors.rst
Dosyayı görüntüle @
bd5279ea
...
...
@@ -397,7 +397,7 @@ succeeded or failed. Look at the following example, which tries to open a file
and print its contents to the screen. ::
for line in open("myfile.txt"):
print line
print line
,
The problem with this code is that it leaves the file open for an indeterminate
amount of time after the code has finished executing. This is not an issue in
...
...
@@ -407,7 +407,7 @@ ensures they are always cleaned up promptly and correctly. ::
with open("myfile.txt") as f:
for line in f:
print line
print line
,
After the statement is executed, the file *f* is always closed, even if a
problem was encountered while processing the lines. Other objects which provide
...
...
Misc/ACKS
Dosyayı görüntüle @
bd5279ea
...
...
@@ -546,6 +546,7 @@ Cédric Krier
Hannu Krosing
Andrej Krpic
Ivan Krstić
Steven Kryskalla
Andrew Kuchling
Ralf W. Grosse-Kunstleve
Dave Kuhlman
...
...
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