Python论坛  - 讨论区

标题:[python-chinese] iis上关于python cgi编程的问题?

2006年07月08日 星期六 09:08

百炀斩FireYang shenhuan007 at gmail.com
Sat Jul 8 09:08:03 HKT 2006

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 不知道上面的错误提示是什么意思? -- 百炀斩


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月08日 星期六 15:51

阎岩 cnyanyan at gmail.com
Sat Jul 8 15:51:22 HKT 2006

An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060708/fd2f5053/attachment-0001.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月08日 星期六 15:53

百炀斩FireYang shenhuan007 at gmail.com
Sat Jul 8 15:53:56 HKT 2006

是不是这样的声明?

在 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 "
> name='name' id='name'>> type='submit' value='submit'>
" > 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 > > -- 百炀斩


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月08日 星期六 16:00

阎岩 cnyanyan at gmail.com
Sat Jul 8 16:00:36 HKT 2006

百炀斩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 "
>> name='name' id='name'>>> type='submit' value='submit'>
" >> 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 -*- 就可以了.你试试看


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号