Inserting-embedding some html data at the end of a .py file

Νίκος Γκρ33κ nikos.gr33k at
Tue Mar 5 21:04:59 CET 2013

	#open html template
	if htmlpage.endswith('.html'):
		f = open( "/home/nikos/public_html/" + htmlpage )

		htmldata =
		counter = ''' <center><a href="mailto:support at"> <img src="/data/images/mail.png"> </a>
			      <center><table border=2 cellpadding=2 bgcolor=black>
				          <td><font color=lime>Αριθμός Επισκεπτών</td>
					  <td><a href=""><font color=cyan> %d </td>
			  ''' % data[0]

	#render template				
	template = htmldata + counter
	print ( template )
Yes the aboev code does work if we talk about appending html data to an already html file!

But if the file is file then i cannot just append the data.
Actually by appending i dont want to actually insert the data to the end of the .py file, thus altering it but instead run the .py file and print the counter html data afterwards!

More information about the Python-list mailing list