Mar-26-2019, 09:14 PM
(This post was last modified: Mar-26-2019, 09:14 PM by ClassicalSoul.)
Hi, I was wondering how I could make string.format round to the left of the decimal.
Moreover, is there somewhere I could have accessed this information, like the help function?
Thanks
1 2 3 |
>>> x = 4. 542412343 >>> '{0} rounded to {1} decimals is {2: .1f}' . format (x, 4 , x) >>> 4.5 |
1 2 3 |
>>> x = 52137809 >>> '{0} rounded to {1} decimals is {2: ???}' . format (x, 4 , x) >>> 50000000 |
Thanks