(I saw this on LinkedIn, but the original post was not very good, so no link)
Recent Python versions has added to the capabilities of Python f strings.
v=12.34
print(f"{v}")
print(f"{v=}")
print(f"|{v}|")
print(f"|{v:.3f}|")
print(f"|{v:8.3f}|")
print(f"|{v:<8.3f}|")
wid = 8
ndec = 3
print(f"|{v:{wid}.{ndec}f}|")
Output:
12.34 v=12.34 |12.34| |12.340| | 12.340| |12.340 | | 12.340|