이것은 매우 간단합니다. 나는 바보 같은 것을 놓치고 있다고 확신합니다.python string.template 객체를 문자열로 변환하는 방법
fp = open(r'D:\UserManagement\invitationTemplate.html', 'rb')
html = Template(fp.read())
fp.close()
html.safe_substitute(toFirstName='jibin',fromFirstName='Vishnu')
print html
이 코드를 intepreter에서 직접 실행하면 적절한 결과를 얻습니다. 그러나 나는 믿을수에서 실행할 때 문이 그 (문자열 변환을) 어떻게해야 인쇄 할되지 않은 안녕 뒤입니다 str(html)
을 시도 string.I에 string.Template 객체로 변환 할 괜찮나 <string.Template object at 0x012D33B0>
를 얻을?