[New-bugs-announce] [issue10873] String formatting example invalid

Ashwin Purohit report at bugs.python.org
Sun Jan 9 13:20:44 CET 2011

New submission from Ashwin Purohit <purohit at gmail.com>:

Your example on page http://docs.python.org/tutorial/inputoutput.html is outdated and won't work in Python 2.7:

Basic usage of the str.format() method looks like this:

>>> print 'We are the {} who say "{}!"'.format('knights', 'Ni')
We are the knights who say "Ni!"

Now, all brackets have to have a numeric or keyword argument.

assignee: docs at python
components: Documentation
messages: 125838
nosy: doagie, docs at python
priority: normal
severity: normal
status: open
title: String formatting example invalid
type: behavior
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list