Change float to string without decimal places

python

Solution

If you want to round the value, do:

str(int(f+0.5))

If you want to truncate the value, do:

str(int(f))

Problem

If I have `f=123.12`, what is easier way to change to string `s="123"`? For now I do: `s = "%.0f" % (f,)`.

Original source