[Python-checkins] r70334 - peps/trunk/pep-0378.txt
raymond.hettinger
python-checkins at python.org
Thu Mar 12 23:36:04 CET 2009
Author: raymond.hettinger
Date: Thu Mar 12 23:36:03 2009
New Revision: 70334
Log:
Neaten-up examples.
Modified:
peps/trunk/pep-0378.txt
Modified: peps/trunk/pep-0378.txt
==============================================================================
--- peps/trunk/pep-0378.txt (original)
+++ peps/trunk/pep-0378.txt Thu Mar 12 23:36:03 2009
@@ -82,9 +82,8 @@
The type specifier approach is locale aware. The picture formatting only
offers a COMMA as a thousands separator::
- String.Format("{0:c}", 12400) ==> "$12,400"
- String.Format("{0:n}", 12400) ==> "12,400"
- String.Format("{0:0,0}", 12400) ==> "12,400"
+ String.Format("{0:n}", 12400) ==> "12,400"
+ String.Format("{0:0,0}", 12400) ==> "12,400"
.. _`C-Sharp`: http://blog.stevex.net/index.php/string-formatting-in-csharp/
@@ -106,7 +105,7 @@
It also allows easy substitution for other separators.
For example::
- format(n, "6,f").replace(",", "_")
+ format(n, "6,d").replace(",", "_")
This technique is completely general but it is awkward in the
one case where the commas and periods need to be swapped::
More information about the Python-checkins
mailing list