Τη Δευτέρα, 4 Μαρτίου 2013 5:59:34 μ.μ. UTC+2, ο χρήστης Michael Torrie έγραψε: > On 03/04/2013 08:14 AM, Ferrous Cranus wrote: > > > Instead of writing the above html data inside my html template how > > > would i write it with a for that then will be substituted by the > > > python script? > > > > What templating system are you using? Django's? > > > > > can you please write an example for me that user "files.html" and > > > gets populates by "files.py" ? > > > > If you're using a CGI script, just use a normal python for loop and > > print out the stuff you want using this kind of notation: > > > > for x in xrange(4): > > print "<tr><td>{0}</td></tr>".format(x) > > > > > > Another alternative is to make your own templating system. Have it load > > and parse the html file (maybe using one of the xml or html parsers), > > and substitude some sort of field marker for data. But that is > > re-inventing the wheel. > > > > http://wiki.python.org/moin/Templating
Firstly thank you for your answer, but iam a bit confised. can i just put the liens you provided me inside "files.html" and thwy will work? Thats pure pythjon code! for x in xrange(4): print "<tr><td>{0}</td></tr>".format(x) wont html complain? -- http://mail.python.org/mailman/listinfo/python-list