Magic Method Recipe: HTML Generation ==================================== Step 0 ------ .. sourcecode:: python from string import Template greeting = 'Salutations' name = 'Abdullah' imgSrc = 'http://www.google.com/intl/en_ALL/images/logo.gif' link = 'http://feihonghsu.blogspot.com' template = Template("""\
""") html = template.substitute(**locals()) print html Expected output: .. sourcecode:: html Solution: `html0.py