#17265: fix highlight in template example. Initial patch by Berker Peksag.

This commit is contained in:
Ezio Melotti 2013-02-21 12:30:32 +02:00
parent 01a97f3612
commit d5bdb1f140
1 changed files with 3 additions and 3 deletions

View File

@ -707,7 +707,7 @@ these rules. The methods of :class:`Template` are:
This is the object passed to the constructor's *template* argument. In This is the object passed to the constructor's *template* argument. In
general, you shouldn't change it, but read-only access is not enforced. general, you shouldn't change it, but read-only access is not enforced.
Here is an example of how to use a Template: Here is an example of how to use a Template::
>>> from string import Template >>> from string import Template
>>> s = Template('$who likes $what') >>> s = Template('$who likes $what')
@ -716,11 +716,11 @@ Here is an example of how to use a Template:
>>> d = dict(who='tim') >>> d = dict(who='tim')
>>> Template('Give $who $100').substitute(d) >>> Template('Give $who $100').substitute(d)
Traceback (most recent call last): Traceback (most recent call last):
[...] ...
ValueError: Invalid placeholder in string: line 1, col 11 ValueError: Invalid placeholder in string: line 1, col 11
>>> Template('$who likes $what').substitute(d) >>> Template('$who likes $what').substitute(d)
Traceback (most recent call last): Traceback (most recent call last):
[...] ...
KeyError: 'what' KeyError: 'what'
>>> Template('$who likes $what').safe_substitute(d) >>> Template('$who likes $what').safe_substitute(d)
'tim likes $what' 'tim likes $what'