python怎样从表单中提取数据
关键词:python 获取表单数据 python 提取数据 python aspx 数据提取
Subject: python怎样从表单中提取数据? Author: kxc Posted: 2002-09-18 22:16 Length: 776 byte(s) |
|
[Original] [Print] [Top] | |
比如web服务器中有这样一个表单: <form method=”post” action=”/cgi-bin/test.cgi”> 用户: <input type=”text” name=”user” size=10><br> 密码: <input type=”password” name=”password” size=10><br> <input type=”submit” name=”login” value=”注册”> </form>test.cgi里面要怎样写才能把”用户”,”密码”的信息提取出来呢? |
|
[Original] [Print] [Top] |
Subject: Re: python怎样从表单中提取数据? Author: xyb Posted: 2002-09-19 09:18 Length: 884 byte(s) |
|
[Original] [Print] [Top] | |
文档里这些写得很清楚呀,下面是其中Lib Ref一个例子:form = cgi.FieldStorage() if not (form.has_key("name") and form.has_key("addr")): print "<H1>Error</H1>" print "Please fill in the name and addr fields." return print "<p>name:", form["name"].value print "<p>addr:", form["addr"].value ...further form processing here...
请参考Python |
|
[Original] [Print] [Top] |
Subject: Re: 谢谢,可以提出来了.还有一个问题 Author: xyb Posted: 2002-09-19 12:57 Length: 1,124 byte(s) |
|
[Original] [Print] [Top] | |
参考pwd — The password database和href=http://www.python.org/doc/current/lib/module-crypt.html>crypt — Function to check Unix passwords,而且原文有一个例子: import crypt, getpass, pwd def login(): username = raw_input('Python login:') cryptedpasswd = pwd.getpwnam(username)[1] if cryptedpasswd: if cryptedpasswd == 'x' or cryptedpasswd == '*': raise "Sorry, currently no support for shadow passwords" cleartext = getpass.getpass() return crypt.crypt(cleartext, cryptedpasswd[:2]) == cryptedpasswd else: return 1
ps. 还有点话想说:这两个问题在Python Lib Ref里可以很容易的找到 |
|
[Original] [Print] [Top] |
Subject: Re: 谢谢,可以提出来了.还有一个问题 Author: kxc Posted: 2002-09-19 13:40 Length: 32 byte(s) |
|
[Original] [Print] [Top] | |
完了,我用的是带SHADOW的passwd:( | |
[Original] [Print] [Top] |
Subject: Re: 谢谢,可以提出来了.还有一个问题 Author: kxc Posted: 2002-09-20 22:30 Length: 165 byte(s) |
|
[Original] [Print] [Top] | |
搞清楚了. /usr/sbin/pwunconv 取消掉shadow例子有点不对:要把 cryptedpasswd[:2] 改成 cryptedpasswd[:11] 这样算出来的结果才对得上 |
|
[Original] [Print] [Top] |
Subject: 谢谢你共享你的处理方法和对例子代码的修改情况 Author: xyb Posted: 2002-09-21 16:56 Length: 8 byte(s) |
|
[Original] [Print] [Top] | |
干得好! |
转载请注明:数据分析 » python怎样从表单中提取数据_python 获取表单数据