Mulig SPAM: float print formatting

hg hg at nospam.org
Tue Feb 13 02:19:55 EST 2007


NOSPAM plz wrote:

> hg skrev:
>> Hi,
>>
>> Considering the float 0.0, I would like to print 00.00.
>>
>> I tried '%02.02f' % 0.0 ... but I get 0.00
>>
>> Any clue ?
>>
>> Thanks,
>>
>> hg
>>
>>   
> Try this:
> 
> a = 45.45 # the floating number
> 
> print "some text",
> print a,
> print "some text again"
> 
> or just this:
> 
> print "some text",
> print 45.45,
> print "some text again"
> 
> Hope it helped :D
> 
> Andreas

Sorry,

must be very slow or not enough coffee yet ... my purpose is to display a
justified report, so I format my floats into strings which I next draw in a
bitmap.

hg





More information about the Python-list mailing list