This is very simple.I am sure I am missing something silly.
fp = open(r'D:\UserManagement\invitationTemplate.html', 'rb')
html = Template(fp.read())
fp.close()
html.safe_substitute(toFirstName='jibin',fromFirstName='Vishnu')
print html
When i run this code in intepreter directly,I get the proper output.
But when I run it from a file.I get <string.Template object at 0x012D33B0>.How do I convert from string.Template object to string.I have tried str(html).By the bye wasn't print statement supposed to do that(string conversion) ?