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
db786876
Kaydet (Commit)
db786876
authored
Ock 21, 2001
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
In format(), consider sign only after grouping.
Suggested by Kevin Jacobs in bug report #129417.
üst
08dabf0a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
locale.py
Lib/locale.py
+9
-4
No files found.
Lib/locale.py
Dosyayı görüntüle @
db786876
...
...
@@ -115,17 +115,22 @@ def format(f,val,grouping=0):
"""Formats a value in the same way that the
%
formatting would use,
but takes the current locale into account.
Grouping is applied if the third parameter is true."""
result
=
f
%
val
fields
=
string
.
split
(
result
,
"."
)
result
=
f
%
abs
(
val
)
fields
=
result
.
split
(
"."
)
if
grouping
:
fields
[
0
]
=
_group
(
fields
[
0
])
if
len
(
fields
)
==
2
:
re
turn
fields
[
0
]
+
localeconv
()[
'decimal_point'
]
+
fields
[
1
]
re
s
=
fields
[
0
]
+
localeconv
()[
'decimal_point'
]
+
fields
[
1
]
elif
len
(
fields
)
==
1
:
re
turn
fields
[
0
]
re
s
=
fields
[
0
]
else
:
raise
Error
,
"Too many decimal points in result string"
if
val
<
0
:
return
'-'
+
res
else
:
return
res
def
str
(
val
):
"""Convert float to integer, taking the locale into account."""
return
format
(
"
%.12
g"
,
val
)
...
...
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