Add one more string formatting example

This commit is contained in:
Srinivasan R 2015-10-28 16:25:54 +05:30
parent 927ac9c3e8
commit db903ac5b6

View File

@ -128,6 +128,7 @@ not False # => True
# A newer way to format strings is the format method.
# This method is the preferred way
"{} is a {}".format("This", "placeholder")
"{0} can be {1}".format("strings", "formatted")
# You can use keywords if you don't want to count.
"{name} wants to eat {food}".format(name="Bob", food="lasagna")