In this Python tutorial, let us have a look at CGI programming in python with an example program.
Introduction of CGI programming in Python
The Common Gateway Interface (CGI) is a standard for writing programs that can interact through a Web server with a client running a Web browser. CGI is the norm for programs to interface with HTTP servers and written dynamically generating webpages that respond to user input or webpages.
#!/usr/bin/python print "Content-type:text/html\r\n\r\n" print '<html>' print '<head>' print '<title>Hello World - First CGI Program</title>' print '</head>' print '<body>' print '<h2>Hello World! This is my first CGI program</h2>' print '</body>' print '</html>'
If you click hello.py, then this produces the following output
Hello World! This is my first CGI program