Using the % symbol in old-style string formatting
- string
- format
%
can be used in string formatting.
>>> print('%s is the #%d word in the Python chatroom!' % ('Cabbage', 1))
Cabbage is the #1 word in the Python chatroom!
Using the % symbol in old-style string formatting
%
can be used in string formatting.
>>> print('%s is the #%d word in the Python chatroom!' % ('Cabbage', 1))
Cabbage is the #1 word in the Python chatroom!
str.format()
syntax.