python string placeholder code example
Example 1: python string format
print("My name is {0} and I am {1} years old".format(name, age))
Example 2: python format strings
name = "Rick"
age = 42
print(f"My name is {name} and I am {age} years old")
Example 3: new python string formatting
>>> f'Hello, {name}!'
'Hello, Bob!'
Example 4: {} string python
txt1 = "My name is {fname}, I'm {age}".format(fname = "John", age = 36)
txt2 = "My name is {0}, I'm {1}".format("John",36)
txt3 = "My name is {}, I'm {}".format("John",36)