In python 3.6 a new string formatting syntax was introduced which was interesting for me. It’s very similar to php or js inline formatting.

name = "Ali";

# php
"Hello $name";

# javascript
`Hello ${name}`;

here is a basic example of python f-string:

name = "Ali"
print(f"Hello {name}")
# Hello Ali

Isn’t it cool?

You can even embed python expressions there:

x = 2
y = 3
print(f"{x} * {y} is {x*y}")
# 2 * 3 is 6

You can also set some cool formatting options:

print(f"{2}")
# 2
print(f"{2:10}")
#          2
print(f"{2:010}")
# 0000000002
print(f"{2.123456789:010}")
# 2.123456789
print(f"{2.123456789:010.2}")
# 00000002.1
print(f"{2.123456789:010.3}")
# 0000002.12