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
785c65cc
Commit
785c65cc
authored
Sep 06, 2004
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Markup nits.
parent
bb30af45
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
Doc/lib/libstring.tex
Doc/lib/libstring.tex
+6
-4
No files found.
Doc/lib/libstring.tex
View file @
785c65cc
...
...
@@ -105,15 +105,17 @@ Instead of the normal \samp{\%}-based substitutions, Template strings support
\item
\samp
{
\$\{
identifier
\}
}
is equivalent to
\samp
{
\$
identifier
}
. It is
required when valid identifier characters follow the placeholder but are
not part of the placeholder,
e.g.
"
\$\{
noun
\}
ification".
not part of the placeholder,
such as
"
\$\{
noun
\}
ification".
\end{itemize}
Any other appearance of
\samp
{
\$
}
in the string will result in a
\exception
{
ValueError
}
being raised.
\versionadded
{
2.4
}
Template strings are used just like normal strings, in that the modulus
operator is used to interpolate a dictionary of values into a Template string,
e.g.
:
for example
:
\begin{verbatim}
>>> from string import Template
...
...
@@ -151,7 +153,7 @@ capturing groups correspond to the rules given above, along with the invalid
placeholder rule:
\begin
{
itemize
}
\item
\var
{
escaped
}
--
This group matches the escape sequence,
i.e.
\samp
{
\$\$
}
\item
\var
{
escaped
}
--
This group matches the escape sequence,
\samp
{
\$\$
}
,
in the default pattern.
\item
\var
{
named
}
--
This group matches the unbraced placeholder name; it
should not include the
\samp
{
\$
}
in capturing group.
...
...
@@ -242,7 +244,7 @@ these functions as deprecated, although they will not be removed until Python
\end
{
funcdesc
}
\begin
{
funcdesc
}{
expandtabs
}{
s
\optional
{
, tabsize
}}
Expand tabs in a string
, i.e.
\
replace
them by one or more spaces,
Expand tabs in a string
replacing
them by one or more spaces,
depending on the current column and the given tab size. The column
number is reset to zero after each newline occurring in the string.
This doesn't understand other non
-
printing characters or escape
...
...
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