Python in HTML

Mirco Wahab wahab at chemie.uni-halle.de
Sun Jun 25 07:36:37 EDT 2006


Thus spoke brochu121 at gmail.com (on 2006-06-23 17:40):

> Does anyone know of a way to embed python scripts into html, much like
> you would javascript or php? I do not want to use this to connect to a
> database, but rather for a functional script to be called when a user
> clicks on a link to open a page.

Aside from the "javascript or php" joke, which
does not belong in such a relation (as others have
already pointed out), there are several methods to
use "PHP"-like Python inclusions, something like:

...
<table>
 <%python>
 for row range(10):
    print "<tr>"
    print "<td>NR</td>" + "<td>" + str(row) + "</td>"
    print "</tr>"
 </%python>
</table>
...


One prominent Example for that would be Myghty
 http://www.myghty.org/docs/whatsitdo.myt

some Examples shown here:
 http://www.myghty.org/docs/embedding.myt

Regards

Mirco



More information about the Python-list mailing list