It is very simple. I'm sure I'm missing something stupid.
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 directly in intrereter, I get the correct output. But when I run it from a file. I get <string.Template object at 0x012D33B0> . How do I convert from a string.Template object to a string. I tried str(html) .By so far no print statement has been specified that should do this (string conversion)
source share