python format with f code example
Example 1: python f string
>>> name = "Eric"
>>> age = 74
>>> f"Hello, {name}. You are {age}."
'Hello, Eric. You are 74.'
Example 2: python fstring
#python3.6 is required
age = 12
name = "Simon"
print(f"Hi! My name is {name} and I am {age} years old")
Example 3: format specificer f strings python
#!/usr/bin/env python3
val = 12.3
print(f'{val:.2f}')
print(f'{val:.5f}')