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
14bb28aa
Kaydet (Commit)
14bb28aa
authored
Tem 29, 2009
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix a few markup glitches.
üst
ffefd5a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
inputoutput.rst
Doc/tutorial/inputoutput.rst
+10
-9
No files found.
Doc/tutorial/inputoutput.rst
Dosyayı görüntüle @
14bb28aa
...
...
@@ -127,16 +127,17 @@ Basic usage of the :meth:`str.format` method looks like this::
We are the knights who say "Ni!"
The brackets and characters within them (called format fields) are replaced with
the objects passed into the format method. The number in the brackets refers to
the position of the object passed into the format method. ::
the objects passed into the :meth:`~str.format` method. The number in the
brackets refers to the position of the object passed into the
:meth:`~str.format` method. ::
>>> print '{0} and {1}'.format('spam', 'eggs')
spam and eggs
>>> print '{1} and {0}'.format('spam', 'eggs')
eggs and spam
If keyword arguments are used in the
format method, their values are referred to
by using the name of the argument. ::
If keyword arguments are used in the
:meth:`~str.format` method, their values
are referred to
by using the name of the argument. ::
>>> print 'This {food} is {adjective}.'.format(
... food='spam', adjective='absolutely horrible')
...
...
@@ -157,7 +158,7 @@ truncates Pi to three places after the decimal.
The value of PI is approximately 3.142.
Passing an integer after the ``':'`` will cause that field to be a minimum
number of characters wide. This is useful for making tables pretty.::
number of characters wide. This is useful for making tables pretty.
::
>>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 7678}
>>> for name, phone in table.items():
...
...
@@ -178,7 +179,7 @@ square brackets ``'[]'`` to access the keys ::
Jack: 4098; Sjoerd: 4127; Dcab: 8637678
This could also be done by passing the table as keyword arguments with the '**'
notation.::
notation.
::
>>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}
>>> print 'Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'.format(**table)
...
...
@@ -356,9 +357,9 @@ shorter than writing equivalent :keyword:`try`\ -\ :keyword:`finally` blocks::
>>> f.closed
True
File objects have some additional methods, such as :meth:`isatty` and
:meth:`
truncate` which are less frequently used; consult the Library Reference
for a complete guide to file objects.
File objects have some additional methods, such as :meth:`
~file.
isatty` and
:meth:`
~file.truncate` which are less frequently used; consult the Library
Reference
for a complete guide to file objects.
.. _tut-pickle:
...
...
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