Sep-03-2019, 07:22 PM
(Sep-03-2019, 06:46 PM)d3fi Wrote: [ -> ]what does "{....:2f} mean? I understand the {dosis:..} fine. thats the one to be used.
When do you use {....:3f or 4f or etc.}
this is string formatting specification
see https://docs.python.org/3/library/string...ing-syntax
.2f
means dosis is float number and you want it to be displayed with 2 decimal places precision, e.g.>>> dosis = 1/3 >>> dosis 0.3333333333333333 >>> f'{dosis:.2f}' '0.33' >>> f'{dosis:.4f}' '0.3333' >>>