string format d python code example
Example 1: python format specifier
from datetime import datetime
'{:%Y-%m-%d %H:%M}'.format(datetime(2001, 2, 3, 4, 5))
Example 2: python format strings
name = "Rick"
age = 42
print(f"My name is {name} and I am {age} years old")
Example 3: python string format
print("My name is {0} and I am {1} years old".format(name, age))