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,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.
That would be the %g conversion specifier. -- http://mail.python.org/mailman/listinfo/python-list