Menu
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 standard for programs to interface with HTTP servers.
- CGI programming is written dynamically generating webpages that respond to user input or webpages that interact with software on the server
Install apache2 on your system can we we will run ‘hello.py’ on host ‘127.0.0.1’
It is recommended to have basic knowledge of HTML before trying this example.
hello.py
It is recommended to have basic knowledge of HTML before trying this example.
hello.py
Any line starting with # in Python programming is a comment. Comments are used in programming to describe the purpose of the code. This helps you as well as other programmers to understand the intent of the code. Comments are completely ignored by compilers and interpreters. Line 2: num1 = 3. Here, num1 is a variable. You can store a value in a variable. Features of the Python programming language; Coding semantics; Website programming; Design practises of applications; Application programming; GUI programming; CGI programming; Network programming; Email programming; XML programming; Python is fast becoming a worldwide Tour De Force that is requested by all companies such as Google, Facebook and Microsoft. This course will ensure you are not left as more and more companies request this awesome language.
# Importing the 'cgi' module print ( 'Content-type: text/htmlrnrn' ) print ( '<h1> Hello Program! </h1>' ) if form.getvalue( 'name' ): print ( '<h1>Hello' + name + '! Thanks for using my script!</h1><br />' ) print ( '<p> Yayy! I'm happy too! </p>' ) print ( '<p> Oh no! Why are you sad? </p>' ) # Using HTML input and forms method print ( '<p>Name: <input type='text' name='name' /></p>' ) print ( '<input type='checkbox' name='happy' /> Happy' ) print ( '<input type='checkbox' name='sad' /> Sad' ) print ( '</form' ) |
This article is contributed by Harsh Wardhan Chaudhary (Intern). If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Recommended Posts:
Python Program to Print Hello world! |
Python Program to Add Two Numbers |
Python Program to Find the Square Root |
Python Program to Calculate the Area of a Triangle |
Python Program to Solve Quadratic Equation |
Python Program to Swap Two Variables |
Python Program to Generate a Random Number |
Python Program to Convert Kilometers to Miles |
Python Program to Convert Celsius To Fahrenheit |
Python Program to Check if a Number is Positive, Negative or 0 |
Python Program to Check if a Number is Odd or Even |
Python Program to Check Leap Year |
Python Program to Find the Largest Among Three Numbers |
Python Program to Check Prime Number |
Python Program to Print all Prime Numbers in an Interval |
Python Program to Find the Factorial of a Number |
Python Program to Display the multiplication Table |
Python Program to Print the Fibonacci sequence |
Python Program to Check Armstrong Number |
Python Program to Find Armstrong Number in an Interval |
Python Program to Find the Sum of Natural Numbers |
Python Program To Display Powers of 2 Using Anonymous Function |
Python Program to Find Numbers Divisible by Another Number |
Python Program to Convert Decimal to Binary, Octal and Hexadecimal |
Python Program to Find ASCII Value of Character |
Python Program to Find HCF or GCD |
Python Program to Find LCM |
Python Program to Find Factors of Number |
Python Program to Make a Simple Calculator |
Python Program to Shuffle Deck of Cards |
Python Program to Display Calendar |
Python Program to Display Fibonacci Sequence Using Recursion |
Python Program to Find Sum of Natural Numbers Using Recursion |
Python Program to Find Factorial of Number Using Recursion |
Python Program to Convert Decimal to Binary Using Recursion |
Python Program to Add Two Matrices |
Python Program to Transpose a Matrix |
Python Program to Multiply Two Matrices |
Python Program to Check Whether a String is Palindrome or Not |
Python Program to Remove Punctuations From a String |
Python Program to Sort Words in Alphabetic Order |
Python Program to Illustrate Different Set Operations |
Python Program to Count the Number of Each Vowel |
Python Program to Merge Mails |
Python Program to Find the Size (Resolution) of a Image |
Python Program to Find Hash of File |