Recap of .format() method (here for a more detailed description).


f'{1000000000:_}'  # {:,} gives similar results with comma

“1_000_000_000”

NB: Multiple spaces are represented with underscores.

f'{42:4d}'

“__42”

f'{3.141592653589793:06.2f}'

“003.14”


f'{100000:.2e}'

“1.00e+05”


f'{"test":>10}'  # ^ to center align, < to left align

____test”


f'{"test":*>10}'

**test”


from datetime import datetime

now: datetime = datetime.now()
f'{now:%d-%m-%y (%H.%M.%S)}'

“14-03-24 (08.08.10)”


a: int = 2
f'{a + a = }'

“a + a = 4”