Python in HTML

tactics40 at gmail.com tactics40 at gmail.com
Fri Jun 23 11:54:42 EDT 2006


Bruno Desthuilliers wrote:
> brochu121 at gmail.com wrote:
> > Does anyone know of a way to embed python scripts into html, much like
> > you would javascript or php?
>
> I think you'd better learn the profound difference between client-side
> and server-side scripting.

Indeed. You really should Google this before continuing.

Python, like it's (evil?) cousin Perl, can be used as a CGI. If you
don't have one already, go download Apache server to play with on your
own machine and Google "Python CGI" and "Python module cgi".

Basically, (after setting up your server correctly), you can do
"http://localhost/index.py" and your webserver will _execute_ your
script. The server then returns the output of your script (everything
from the print statements) to the web browser.




More information about the Python-list mailing list