String formatting

We can create strings by putting placeholders in string templates, and then substituting values for those placeholders. Here is an example:

In [1]:
"I got %d in %s. I feel %s about that!" % (95, "Linear Algebra", "great")
Out[1]:
'I got 95 in Linear Algebra. I feel great about that!'

95 got substituted for %d, "Linear Algebra" got substituted for the first "s", and "great" got substituted for the second %s.

%d stands for "decimal." It must be substituted with an int. %s stands for "string." It must be substituted with a string. %f stands for "float." It must be substituted with a float.

The placeholders get substituted by the arguments supplied to the right, in order