From: Ezio Melotti Date: Thu, 21 Feb 2013 10:30:32 +0000 (+0200) Subject: #17265: fix highlight in template example. Initial patch by Berker Peksag. X-Git-Tag: v2.7.4rc1~95 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d5bdb1f140f9f74746ff6413194ddd119ce5f1de;p=python #17265: fix highlight in template example. Initial patch by Berker Peksag. --- diff --git a/Doc/library/string.rst b/Doc/library/string.rst index a55c6b0728..b2717a026e 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -707,7 +707,7 @@ these rules. The methods of :class:`Template` are: 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 @@ Here is an example of how to use a Template: >>> 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'