You are also mixing
It can be done a easier with f-string,then there no need for fomat() at all.
f-string
and format()
.It can be done a easier with f-string,then there no need for fomat() at all.
id = 1000 location = 'fooooooooo' max_temp = 40000.458545 min_temp = 1000.7895642 precipitation = 7575.45454 print(f'{id:d} : {location:.3} : {max_temp:.2f} / {min_temp:.2f} / {precipitation:.1f}')
Output:1000 : foo : 40000.46 / 1000.79 / 7575.5
Also id
is a name used bye Python,so use something else eg temp_id = 1000
.