

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to write first Hello World program using CGI programming in Python?
First CGI Program
A CGI script called hello.py is kept in /var/www/cgi-bin directory and it has following content. Before running the CGI program, we make sure we change the mode of file using chmod 755 hello.py UNIX command to make file executable.
Example
#!/usr/bin/python print "Content-type:text/html\r\n\r\n" print '<html>' print '<head>' print '<title>Hello Word - First CGI Program</title>' print '</head>' print '<body>' print '<h2>Hello Word! This is my first CGI program</h2>' print '</body>' print '</html>'
Output
If you click hello.py, then this produces the following output −
Hello Word! This is my first CGI program
- Related Questions & Answers
- Hello World in Dart Programming
- How to write "Hello, World!" program in JavaScript?
- How to write "Hello World" Program in C++?
- Python Program to Print Hello world
- First Hello World project in Arduino
- Beginning C# programming with Hello World
- Beginning Java programming with Hello World
- How to write "Hello World" in C#?
- Hello World using Perl.
- Beginning Java programming with Hello World Example
- How to print "Hello World!" using Python?
- Hello World Program in Java
- Creating Java Hello World Program
- Display hello world using React.js
- Write a program to display "Hello World" in react native?
Advertisements