Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #12001
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <przemolicc@poczta.fm> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | UNSURE 0.300 |
| X-Spam-Level | *** |
| X-Spam-Evidence | '*H*': 0.57; '*S*': 0.17; 'locale': 0.09; 'trailing': 0.09; 'zeros': 0.09; '>>>': 0.18; 'skip:l 30': 0.24; 'import': 0.28; 'print': 0.29; 'format:': 0.30; 'to:addr:python-list': 0.33; 'header:User-Agent:1': 0.34; 'hello,': 0.38; 'to:addr:python.org': 0.39; 'from:no real name:2**0': 0.63; 'charset:iso-8859-2': 0.66; 'subject:without': 0.67; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.71; 'received:pl': 0.84; 'subject:skip:l 10': 0.84; 'url:pl': 0.93 |
| Date | Mon, 22 Aug 2011 10:52:53 +0200 |
| From | przemolicc@poczta.fm |
| To | python-list@python.org |
| Subject | locale.format without trailing zeros |
| MIME-Version | 1.0 |
| User-Agent | Mutt/1.5.18 (2008-05-17) |
| X-Interia-Antivirus | OK |
| X-EMID | 6b9efc98 |
| Content-Type | text/plain; charset="iso-8859-2" |
| Content-Transfer-Encoding | quoted-printable |
| Content-Disposition | inline |
| X-Mailman-Approved-At | Mon, 22 Aug 2011 11:30:05 +0200 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | przemolicc@poczta.fm |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.303.1314005406.27778.python-list@python.org> (permalink) |
| Lines | 73 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1314005406 news.xs4all.nl 23855 [2001:888:2000:d::a6]:44056 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:12001 |
Show key headers only | View raw
Hello,
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "pl_PL")
'pl_PL'
>>> i=0.20
>>> j=0.25
>>> locale.format('%f', i)
'0,200000'
>>> locale.format('%f', j)
'0,250000'
I need to print the numbers in the following format:
'0,2' (i)
'0,25' (j)
So the last trailing zeros are not printed.
Regards
Przemyslaw Bak (przemol)
----------------------------------------------------------------
Najwieksza baza najtanszych ofert mieszkaniowych
http://linkint.pl/f2a0e
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
locale.format without trailing zeros przemolicc@poczta.fm - 2011-08-22 10:52 +0200
Re: locale.format without trailing zeros Peter Otten <__peter__@web.de> - 2011-08-22 11:48 +0200
Re: locale.format without trailing zeros przemolicc@poczta.fm - 2011-08-22 13:08 +0200
Re: locale.format without trailing zeros przemolicc@poczta.fm - 2011-08-22 13:29 +0200
Re: locale.format without trailing zeros Peter Otten <__peter__@web.de> - 2011-08-22 15:01 +0200
Re: locale.format without trailing zeros Anssi Saari <as@sci.fi> - 2011-08-22 13:59 +0300
csiph-web