template systems (in this case using HTML) : Template : String PYTHON TUTORIALS


PYTHON TUTORIALS » String » Template »

 

template systems (in this case using HTML)


from string import Template


template = '''<html
<head><title>%(title)s</title></head> 
<body
<h1>%(title)s</h1> 
<paragraph>%(text)s</paragraph> 
</body>'''


data = {'title': 'My Home Page', 'text': 'Welcome to my home page!'}
print template % data



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo String
» Template