我想只填写一个smiple form所以我不想使用任何非标准库。 然后只需发送HTTPPOST即可。请求包含字段 和您要提交的数据。 - Grant Edwards grante哇! LBJ,LBJ,你今天告诉JOKES多少 ??! visi.com I need to fill form from web site, the code for this form looks likethis:<form action="login.php" method="post" target="_top"><input type="text" name="username" size="25" maxlength="40"class="post" /><input type="password" name="password" size="25" maxlength="25"class="post" /><input type="hidden" name="redirect"value="" /><input type="submit" name="login" class="mainoption"value="Login" /></form>I can of course connect to a web site and download the form, i do itlike this:import urllib2www = urllib2.urlopen("http://www.site.com/login.php")form_data= stronka.read()or using httplib:import httplibconn = httplib.HTTPConnection("www.site.com")conn.request("GET", "/login.php")data1 = conn.getresponse().read()but i can''t fill and send this form is there some simple way to do it? 解决方案I''d recommend you take a look at mechanize, see http://wwwsearch.sourceforge.net/mechanize/and specifically at ClientForm, see http://wwwsearch.sourceforge.net/ClientForm/These make it easy to perform browser-like accesses to forms-based webapplications.regardsSteve--Steve Holden +44 150 684 7255 +1 800 494 3119Holden Web LLC/Ltd http://www.holdenweb.comSkype: holdenweb http://holdenweb.blogspot.comRecent Ramblings http://del.icio.us/steve.holdenI want to fill only one smiple form so i would like not to use any nonstandard libraries.Then just send the HTTP "POST" request containing the fieldsand data you want to submit.--Grant Edwards grante Yow! LBJ, LBJ, how manyat JOKES did you tell today??!visi.com 这篇关于如何填写表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-27 01:36