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
bf899818
Kaydet (Commit)
bf899818
authored
Tem 18, 2008
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Document the different meaning of precision for {:f} and {:g}.
Also document how inf and nan are formatted. #3404.
üst
730c8185
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
string.rst
Doc/library/string.rst
+12
-8
No files found.
Doc/library/string.rst
Dosyayı görüntüle @
bf899818
...
@@ -387,10 +387,11 @@ zero-padding. This is equivalent to an *alignment* type of ``'='`` and a *fill*
...
@@ -387,10 +387,11 @@ zero-padding. This is equivalent to an *alignment* type of ``'='`` and a *fill*
character of ``'0'``.
character of ``'0'``.
The *precision* is a decimal number indicating how many digits should be
The *precision* is a decimal number indicating how many digits should be
displayed after the decimal point for a floating point value. For non-number
displayed after the decimal point for a floating point value formatted with
types the field indicates the maximum field size - in other words, how many
``'f'`` and ``'F'``, or before and after the decimal point for a floating point
characters will be used from the field content. The *precision* is ignored for
value formatted with ``'g'`` or ``'G'``. For non-number types the field
integer values.
indicates the maximum field size - in other words, how many characters will be
used from the field content. The *precision* is ignored for integer values.
Finally, the *type* determines how the data should be presented.
Finally, the *type* determines how the data should be presented.
...
@@ -418,7 +419,7 @@ The available integer presentation types are:
...
@@ -418,7 +419,7 @@ The available integer presentation types are:
| | the current locale setting to insert the appropriate |
| | the current locale setting to insert the appropriate |
| | number separator characters. |
| | number separator characters. |
+---------+----------------------------------------------------------+
+---------+----------------------------------------------------------+
| None |
the same as ``'d'``
|
| None |
The same as ``'d'``.
|
+---------+----------------------------------------------------------+
+---------+----------------------------------------------------------+
The available presentation types for floating point and decimal values are:
The available presentation types for floating point and decimal values are:
...
@@ -439,10 +440,13 @@ The available presentation types for floating point and decimal values are:
...
@@ -439,10 +440,13 @@ The available presentation types for floating point and decimal values are:
+---------+----------------------------------------------------------+
+---------+----------------------------------------------------------+
| ``'g'`` | General format. This prints the number as a fixed-point |
| ``'g'`` | General format. This prints the number as a fixed-point |
| | number, unless the number is too large, in which case |
| | number, unless the number is too large, in which case |
| | it switches to ``'e'`` exponent notation. |
| | it switches to ``'e'`` exponent notation. Infinity and |
| | NaN values are formatted as ``inf``, ``-inf`` and |
| | ``nan``, respectively. |
+---------+----------------------------------------------------------+
+---------+----------------------------------------------------------+
| ``'G'`` | General format. Same as ``'g'`` except switches to |
| ``'G'`` | General format. Same as ``'g'`` except switches to |
| | ``'E'`` if the number gets to large. |
| | ``'E'`` if the number gets to large. The representations |
| | of infinity and NaN are uppercased, too. |
+---------+----------------------------------------------------------+
+---------+----------------------------------------------------------+
| ``'n'`` | Number. This is the same as ``'g'``, except that it uses |
| ``'n'`` | Number. This is the same as ``'g'``, except that it uses |
| | the current locale setting to insert the appropriate |
| | the current locale setting to insert the appropriate |
...
@@ -451,7 +455,7 @@ The available presentation types for floating point and decimal values are:
...
@@ -451,7 +455,7 @@ The available presentation types for floating point and decimal values are:
| ``'%'`` | Percentage. Multiplies the number by 100 and displays |
| ``'%'`` | Percentage. Multiplies the number by 100 and displays |
| | in fixed (``'f'``) format, followed by a percent sign. |
| | in fixed (``'f'``) format, followed by a percent sign. |
+---------+----------------------------------------------------------+
+---------+----------------------------------------------------------+
| None |
the same as ``'g'``
|
| None |
The same as ``'g'``.
|
+---------+----------------------------------------------------------+
+---------+----------------------------------------------------------+
...
...
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