mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Merged revisions 63655 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r63655 | benjamin.peterson | 2008-05-25 19:54:22 -0500 (Sun, 25 May 2008) | 2 lines update the tutorial to use str.format ........
This commit is contained in:
parent
dc6c16ac63
commit
e6f00637be
7 changed files with 84 additions and 34 deletions
|
|
@ -515,7 +515,7 @@ with the :func:`zip` function. ::
|
|||
>>> questions = ['name', 'quest', 'favorite color']
|
||||
>>> answers = ['lancelot', 'the holy grail', 'blue']
|
||||
>>> for q, a in zip(questions, answers):
|
||||
... print('What is your %s? It is %s.' % (q, a))
|
||||
... print('What is your {0}? It is {1}.'.format(q, a))
|
||||
...
|
||||
What is your name? It is lancelot.
|
||||
What is your quest? It is the holy grail.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue