Re: locale.format without trailing zeros

2011-08-22 Thread Peter Otten
przemol...@poczta.fm wrote: > How about this format: > ',1' > (the local zero is also not printed) > > (I know this is strange but I need compatibility with local requirements) I believe you have to do it yourself: >>> locale.format("%f", 0.123) '0,123000' >>> locale.format("%f", 0.123).strip("

Re: locale.format without trailing zeros

2011-08-22 Thread przemolicc
On Mon, Aug 22, 2011 at 11:48:46AM +0200, Peter Otten wrote: > przemol...@poczta.fm wrote: > > import locale > locale.setlocale(locale.LC_ALL, "pl_PL") > > 'pl_PL' > i=0.20 > j=0.25 > locale.format('%f', i) > > '0,20' > locale.format('%f', j) > > '0,25' > > >

Re: locale.format without trailing zeros

2011-08-22 Thread przemolicc
On Mon, Aug 22, 2011 at 11:48:46AM +0200, Peter Otten wrote: > przemol...@poczta.fm wrote: > > import locale > locale.setlocale(locale.LC_ALL, "pl_PL") > > 'pl_PL' > i=0.20 > j=0.25 > locale.format('%f', i) > > '0,20' > locale.format('%f', j) > > '0,25' > > >

Re: locale.format without trailing zeros

2011-08-22 Thread Anssi Saari
przemol...@poczta.fm writes: > Hello, > import locale locale.setlocale(locale.LC_ALL, "pl_PL") > 'pl_PL' i=0.20 j=0.25 locale.format('%f', i) > '0,20' locale.format('%f', j) > '0,25' > > I need to print the numbers in the following format: > '0,2' (i) > '0,25'

Re: locale.format without trailing zeros

2011-08-22 Thread Peter Otten
przemol...@poczta.fm wrote: import locale locale.setlocale(locale.LC_ALL, "pl_PL") > 'pl_PL' i=0.20 j=0.25 locale.format('%f', i) > '0,20' locale.format('%f', j) > '0,25' > > I need to print the numbers in the following format: > '0,2' (i) > '0,25'(j)

locale.format without trailing zeros

2011-08-22 Thread przemolicc
Hello, >>> import locale >>> locale.setlocale(locale.LC_ALL, "pl_PL") 'pl_PL' >>> i=0.20 >>> j=0.25 >>> locale.format('%f', i) '0,20' >>> locale.format('%f', j) '0,25' I need to print the numbers in the following format: '0,2' (i) '0,25' (j) So the last trailing zeros are not printed.