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("
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'
> >
>
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'
> >
>
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'
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)
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.