It just means significant digits in the general format, which alternates between 10-exponent notation and plain decimal notation.
https://docs.python.org/3.4/library/string.html#format-specification-mini-language >>> '{:.3}'.format(0.0000356785) '3.57e-05' >>> '{:.3}'.format(0.00356785) '0.00357' On Mon, 8 Jun 2015 at 22:33 Skip Montanaro <skip.montan...@gmail.com> wrote: > This is counterintuitive: > > >>> "{:.3}".format(-0.00666762259822) > '-0.00667' > >>> "{:.3f}".format(-0.00666762259822) > '-0.007' > >>> "%.3f" % -0.00666762259822 > '-0.007' > >>> "{:.3s}".format(-0.00666762259822) > ValueError Unknown format code 's' for object of type 'float' > > Why does the first form display five digits after the decimal point? Why > don't floats support "{:.Ns}"? (I know I can use "{!s}".) > > This is using a freshly hg pulled and updated 2.7 branch. > > Thx, > > S > > > -- > https://mail.python.org/mailman/listinfo/python-list >
-- https://mail.python.org/mailman/listinfo/python-list