[Tutor] String formatting expression "g" conversion type case.

Peter Otten __peter__ at web.de
Thu Jan 24 15:12:10 CET 2013


Krupkina Lesya Olegovna wrote:

> Python outputs decimal as declared as but with more significant digits
> than default value of 6 - if integer part of the decimal is equal to zero.
>>>> "%#g"%0.3
> '0.300000'

In this context "significant digits" are the first non-zero digit and any 
digits (including zero) that follow it.



More information about the Tutor mailing list