lang/python/ PythonNumberFormatting
Precision and zero-padding
x = 1
y = 3.14
print(f"{x} {x=} {x:05d} {y:0.05f}")
prints
1 x=1 00001 3.14000
commas
To separate digits with a comma
x = 2432243242
print(f"{x=:,}")
prints
x=28,429,834,982
comma and decimal
x = 22343242.232432
print(f"{x=:0,.3f}")
prints
x=22,343,242.232