Rounding a number

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Apr 30 16:08:23 EDT 2015


On 30/04/2015 21:00, Thijs Engels wrote:
> On Thu, Apr 30, 2015, at 21:49, Seymore4Head wrote:
>> I have this page book marked.
>> https://mkaz.com/2012/10/10/python-string-format/
>>>> I am getting numbers from sixty thousand to two hundred thousand.
>> I would like to round them to the nearest thousand.
>> So 65,253 should read 65,000.
>> How?
>>>> Total=2100
>> for x in range (10,35):
>> count=1000/x
>> print ("Foo {:7,.0f} Fighters".format(Total*count))
>> --
>> https://mail.python.org/mailman/listinfo/python-list
 > round(65253, -3)
 >
 > might be what you are looking for...
 >
 >
True, but please don't top post here. It's no problem on short threads, 
but as they get longer trying to follow when top posting is involved is 
nigh on impossible.
-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /