[Tutor] Meaning of %g ?

Kent Johnson kent37 at tds.net
Fri Apr 14 17:29:27 CEST 2006


Kent Johnson wrote:
> Alan Gauld wrote:
>>>>> print "%14.3g\n%14.3e\n%14.3f" % (bignum,bignum,bignum)
>>      1.23e+009
>>     1.235e+009
>> 1234567898.235
>>
>> Hopefully those examples show whats happening.
>> I have no idea why %g is dropping a digit, it may even be a bug!
> 
> It looks to me like either a documentation error or a bug. It might be 
> worth asking on c.l.py.

Which I did; see here for Fredrik Lundh's answer:
http://groups.google.com/group/comp.lang.python/msg/f8dca0d28c426d48?hl=en&

Kent



More information about the Tutor mailing list