String Formatters
k="{} teaches python"
print(k.format("Satish"))
Output
Satish teaches python
Formatters Example
print("{} teaches python".format("Satish"))
Output
Satish teaches python
String Formatters - Multiple Placeholders
k="{} teaches python for class {}"
print(k.format("Satish","317"))
Output
Satish teaches python for class 317
Formatters with positional arguments
k="{0} is {1}"
print(k.format("test","best"))
Output
test is best
Switching Positions
k="{1} is {0}"
print(k.format("test","best"))
Output
best is test
Keyword Arguments
k="{0} is {b}"
print(k.format("test",b="best"))
Output
test is best