2006年07月08日 星期六 09:08
import cgi #倒入cgi模块 print 'Content-Type: text/html' #必须,输出HTML文档头 print # Blank line marking end of HTTP headers #必须,文档头必须以空行结束 cgiParameters = cgi.FieldStorage() #取得Post或Get过来的参数集 # 检查看是否是我们需要的参数 if not (cgiParameters.has_key("name") and cgiParameters.has_key("address")): #如果不是输出form,要求填写name和address print "" print "Please fill in the name and address fields." else: #如果是我们要求的参数,输出参数内容 print "
name:", cgiParameters["name"].value print "
address:", cgiParameters["address"].value sys:1: DeprecationWarning: Non-ASCII character '\xb5' in file F:\python\work\deitel\cgi_test.py on line 2, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details 不知道上面的错误提示是什么意思? -- 百炀斩
2006年07月08日 星期六 15:51
An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060708/fd2f5053/attachment-0001.html
2006年07月08日 星期六 15:53
是不是这样的声明? 在 06-7-8,阎岩<cnyanyan at gmail.com> 写道: > > 百炀斩FireYang 写道: > import cgi > #倒入cgi模块 > print 'Content-Type: text/html' > #必须,输出HTML文档头 > print > # Blank line marking end of HTTP headers > #必须,文档头必须以空行结束 > > cgiParameters = cgi.FieldStorage() > #取得Post或Get过来的参数集 > > # 检查看是否是我们需要的参数 > if not (cgiParameters.has_key("name") and cgiParameters.has_key("address")): > #如果不是输出form,要求填写name和address > print "" > print "Please fill in the name and address fields." > else: > #如果是我们要求的参数,输出参数内容 > print "
name:", cgiParameters["name"].value > print "
address:", cgiParameters["address"].value > > > sys:1: DeprecationWarning: Non-ASCII character '\xb5' in file > F:\python\work\deitel\cgi_test.py on line 2, but no > encoding declared; > see http://www.python.org/peps/pep-0263.html for details > > 不知道上面的错误提示是什么意思? > > ________________________________ > _______________________________________________ python-chinese Post: > send python-chinese at lists.python.cn Subscribe: send subscribe to > python-chinese-request at lists.python.cn Unsubscribe: send > unsubscribe to > python-chinese-request at lists.python.cn Detail Info: > http://python.cn/mailman/listinfo/python-chinese > 需要声明一下文件的编码 > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to > python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to > python-chinese-request at lists.python.cn > Detail Info: > http://python.cn/mailman/listinfo/python-chinese > > -- 百炀斩
2006年07月08日 星期六 16:00
百炀斩FireYang 写道: > 是不是这样的声明? > > 在 06-7-8,阎岩<cnyanyan at gmail.com> 写道: >> >> 百炀斩FireYang 写道: >> import cgi >> #倒入cgi模块 >> print 'Content-Type: text/html' >> #必须,输出HTML文档头 >> print >> # Blank line marking end of HTTP headers >> #必须,文档头必须以空行结束 >> >> cgiParameters = cgi.FieldStorage() >> #取得Post或Get过来的参数集 >> >> # 检查看是否是我们需要的参数 >> if not (cgiParameters.has_key("name") and >> cgiParameters.has_key("address")): >> #如果不是输出form,要求填写name和address >> print "" >> print "Please fill in the name and address fields." >> else: >> #如果是我们要求的参数,输出参数内容 >> print "
name:", cgiParameters["name"].value >> print "
address:", cgiParameters["address"].value >> >> >> sys:1: DeprecationWarning: Non-ASCII character '\xb5' in file >> F:\python\work\deitel\cgi_test.py on line 2, but no >> encoding declared; >> see http://www.python.org/peps/pep-0263.html for details >> >> 不知道上面的错误提示是什么意思? >> >> ________________________________ >> > _______________________________________________ > python-chinese > Post: >> send python-chinese at lists.python.cn > Subscribe: send subscribe to >> python-chinese-request at lists.python.cn > Unsubscribe: send >> unsubscribe to >> python-chinese-request at lists.python.cn > Detail Info: >> http://python.cn/mailman/listinfo/python-chinese >> 需要声明一下文件的编码 >> >> _______________________________________________ >> python-chinese >> Post: send python-chinese at lists.python.cn >> Subscribe: send subscribe to >> python-chinese-request at lists.python.cn >> Unsubscribe: send unsubscribe to >> python-chinese-request at lists.python.cn >> Detail Info: >> http://python.cn/mailman/listinfo/python-chinese >> >> > > 在第一行加入如下: # -*- coding: cp936 -*- 就可以了.你试试看
Zeuux © 2025
京ICP备05028076号