Python String Formatting : Python uses C-style string formatting to create new, formatted strings. The “%” operator is used to format a set of variables enclosed in a “tuple” (a fixed size list), together with a format string, which contains normal text together with “argument specifiers“, special symbols like “%s” and “%d“.
Let’s say you have a variable called “name” with your username in it, and you would then like to print(out a greeting to that user.)
# This prints out "Hello, John!" name = "John" print("Hello, %s!" % name)