I am searching for the functionality in Jython, that the ouput of a float only has decimal points when it isn't an integer.
I've found:
>>> x = 23.457413902458498
>>> s = format(x, '.5f')
>>> s
'23.45741'
But
>>> y=10
>>> format(y, '.2f')
'10.00'
In this case I would like to have only
'10'
Can you help me?!
Thank you for your help!!!
This will work in Jython 2.7 where x is your float to be formatted and the value after the else will set your number of decimal places: