from string import Templatetemplate = ''' %(title)s %(title)s %(text)s '''data = {'title': 'My Home Page', 'text': 'Welcome to my home page!'}print template % data