python float to string n decimals

48

python float to string n decimals -

float = 2.154327
format_float = "{:.2f}".format(float)	# change .2f to n digits you want
print(format_float)

Comments

Submit
0 Comments