August 2019
Beginner
482 pages
12h 56m
English
A string's format method will inject its arguments into the string, replacing the fields defined by curly braces. A specific field can be defined either by the number (in this case, you just should keep arguments in the same order) or by using keywords. Here are some examples:
>>> ‘Hello {} world and our blue {}'.format(‘beautiful', ‘planet')'Hello beautiful world and our blue planet'
>>> ‘{0} {2} {1} and our {2} {3}!'.format('Hello','World','Beautiful', 'Planet')'Hello Beautiful World and our Beautiful Planet!'