In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian for you to introduce in detail "how to use Python to create the first CGI program", the content is detailed, the steps are clear, the details are handled properly, I hope this "how to use Python to create the first CGI program" article can help you solve your doubts, following the editor's ideas slowly in-depth, together to learn new knowledge.
The first CGI program
We use Python to create the first CGI program, the file name is hello.py, and the file is located in the / var/www/cgi-bin directory, as follows:
#! / usr/bin/python3
Print ("Content-type:text/html")
Print () # blank line, telling the server to end the header
Print ('')
Print ('')
Print ('')
Print ('Hello Word-my first CGI program!')
Print ('')
Print ('')
Print ('Hello Word! I am the first CGI program from the rookie tutorial')
Print ('')
Print ('')
Modify the hello.py after the file is saved, and modify the file permission to 755:
Chmod 755 hello.py
The results of the above programs are displayed in the browser as follows:
The hello.py script for this is a simple Python script in which the output of the first line of the script "Content-type:text/html" is sent to the browser and tells the browser that the type of content displayed is "text/html".
Use print to output a blank line to tell the server the end header information.
Read here, this "how to use Python to create the first CGI program" article has been introduced, want to master the knowledge of this article also need to practice and use to understand, if you want to know more about the article, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.