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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 Hello, >>> import locale >>> locale.setlocale(locale.LC_ALL, "pl_PL") 'pl_PL' >>> i=3D0.20 >>> j=3D0.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