This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2008年04月01日 11:35 by mark, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg64804 - (view) | Author: Mark Summerfield (mark) * | Date: 2008年04月01日 11:35 | |
>>> # Py30a3
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "en_US.UTF8")
'en_US.UTF8'
>>> locale.format("%d", 12345, True)
'12,345'
>>> "{0:n}".format(12345)
'12345'
According to the docs the 'n' format should use the locale-dependent
separator, so I expected both strings to be '12,345'.
Also, it is a pity that locale.format() uses the old deprecated % syntax
rather than the much nicer and better str.format() syntax.
|
|||
| msg64959 - (view) | Author: Neal Norwitz (nnorwitz) * (Python committer) | Date: 2008年04月05日 02:59 | |
Eric, could you take a look? |
|||
| msg64968 - (view) | Author: Eric V. Smith (eric.smith) * (Python committer) | Date: 2008年04月05日 10:49 | |
I'm looking into it. |
|||
| msg64974 - (view) | Author: Eric V. Smith (eric.smith) * (Python committer) | Date: 2008年04月05日 14:35 | |
The same issue exists with floats:
# continuing the example
>>> locale.format("%g", 12345, True)
'12,345'
>>> "{0:n}".format(12345.0)
'12345'
The same issue exists in 2.6.
|
|||
| msg65988 - (view) | Author: Eric V. Smith (eric.smith) * (Python committer) | Date: 2008年04月30日 01:10 | |
Committed fix in r62586. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:32 | admin | set | github: 46778 |
| 2008年04月30日 01:10:18 | eric.smith | set | status: open -> closed resolution: fixed messages: + msg65988 |
| 2008年04月05日 14:35:32 | eric.smith | set | title: str.format() :n format does not appear to work -> str.format() :n format does not appear to work for int and float messages: + msg64974 versions: + Python 2.6 |
| 2008年04月05日 10:49:50 | eric.smith | set | messages: + msg64968 |
| 2008年04月05日 02:59:06 | nnorwitz | set | priority: high assignee: eric.smith messages: + msg64959 nosy: + eric.smith, nnorwitz |
| 2008年04月01日 11:35:24 | mark | create | |