Python Web programming (CGI)

Source: Internet
Author: User

1) Simple procedure, reference several key processing can:
#coding =utf-8#!/usr/bin/python# CGI processing module from OS import environimport CGI, cgitb# creates fieldstorage instantiation form = cgi. Fieldstorage () # gets data user_id = "A";p assword= "B"; first_name = Form.getvalue (' first_name ') last_name = Form.getvalue (' Last_Name ') en = environ.get (' http_cookie ') + ""; coks = En.split (';')    For C in coks:kv = C.split ("=");        if (kv[0]== ' UserID '): user_id=kv[1];   Continue if (kv[0]== ' Password '): password=kv[1]; Print (' content-type:text/html\r\n\r\n ') print ("set-cookie:userid=xyz;\r\n") print ("set-cookie:password=xyz123;\r \ n ") print (" Set-cookie:expires=tuesday, 31-dec-2007 23:12:40 gmt\ "; \ r \ n") print ("set-cookie:domain=www.w3cschool.cc \ \ r \ n ") print (" set-cookie:path=/perl;\n ") print (' 


2) configuration is critical (IIS7.0):

3) press below to fill in the following:

It's no big difference to go here and deal with the C # language. Python is a better type of script to serve as a data provider for the server.
Python language in many places, especially the type, class and other aspects with JS very similar, but no JS complex.
Read it over again, can I get to a language?

Python Web programming (CGI)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.