[Python-checkins] cpython (2.7): #17265: fix highlight in template example. Initial patch by Berker Peksag.
ezio.melotti
python-checkins at python.org
Thu Feb 21 11:36:11 CET 2013
http://hg.python.org/cpython/rev/943ea41d3ceb
changeset: 82292:943ea41d3ceb
branch: 2.7
parent: 82289:479bc802a645
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Thu Feb 21 12:30:32 2013 +0200
summary:
#17265: fix highlight in template example. Initial patch by Berker Peksag.
files:
Doc/library/string.rst | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Doc/library/string.rst b/Doc/library/string.rst
--- a/Doc/library/string.rst
+++ b/Doc/library/string.rst
@@ -707,7 +707,7 @@
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.
-Here is an example of how to use a Template:
+Here is an example of how to use a Template::
>>> from string import Template
>>> s = Template('$who likes $what')
@@ -716,11 +716,11 @@
>>> d = dict(who='tim')
>>> Template('Give $who $100').substitute(d)
Traceback (most recent call last):
- [...]
+ ...
ValueError: Invalid placeholder in string: line 1, col 11
>>> Template('$who likes $what').substitute(d)
Traceback (most recent call last):
- [...]
+ ...
KeyError: 'what'
>>> Template('$who likes $what').safe_substitute(d)
'tim likes $what'
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list