tags:

views:

87

answers:

1

NOT SURE ABOUT THIS: I think we cannot embed python code in html like we do with PHP, JSP

I have a piece of code I am trying to tamper with. PAGE = urllib.unquote_plus("%3C%21doctype+html+public+%22-%2F%2FW3C%2FDTD+HTML+4.01%2F%2FEN%22+%22http ........

When I view source in the html file, I can see it being neatly displayed. But I am having a very hard time trying to figure out the %22 3C

What is happening? How to convert a sample code written neatly that python can understand.

+4  A: 

You can use a template engine like Jinja2, Django's Template Engine or Mako Templates.

jbochi
Seconded on Mako templates.
Eric Palakovich Carr
I don't like embedding python code in html, but I think it's the best answer to the question ;-)
jbochi
I need to add just one like like this<img src="http://www..com/tw.png "/>Do I need to use Django for this. Should I resort to decrypting the %3FC%2 etc ?Is there any software which will automatically do the conversion?
Karthik Kottapalli