Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
bcbc5678
Commit
bcbc5678
authored
Feb 21, 2013
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#17265: fix highlight in template example. Initial patch by Berker Peksag.
parent
b3d62cef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Doc/library/string.rst
Doc/library/string.rst
+3
-3
No files found.
Doc/library/string.rst
View file @
bcbc5678
...
...
@@ -688,7 +688,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')
...
...
@@ -697,11 +697,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'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment