Name
Template
Synopsis
class Template(source=None,searchList=[],file=None)
Always call Template with named arguments (except,
optionally, the first one); number and order of formal arguments may
change in the future, but the names are guaranteed to stay. You must
pass either source or
file, but not both.
source is a template string.
file is a file-like object open for
reading, or the path to a file to open for reading.
searchList is a sequence of objects to use
as top-level sources for
$
name insertion. An
instance t of class
Template is implicitly appended at the end of
t’s search list (e.g.,
$a in the template inserts the value of
t
.a if no other object
in the search list has an attribute a or an item
with a key of 'a').
searchList defaults to the empty list, so,
by default, t’s template
expansion uses only t’s
attributes as variables for $ substitution.
Class Template also allows other keyword
arguments, but these are the most frequently used. The instance
t supplies many methods, but normally you
only call
str(
t
),
which returns the string form of the expanded template.