In Python, when I execute the following statement:
'{:.0}'.format(0.55) # 0.6
it evaluates to the string '0.6'
, however what I expected was the string '1'
.
However, when I state the type symbol 'f'
, somehow what I expect is exactly what I get.
'{:.0f}'.format(0.55) # 1
What does the 'f'
symbol do here? Why does the format string without 'f'
not produce the outcome that I wanted?