- 论坛徽章:
- 0
|
本帖最后由 wqjwftcaqr 于 2011-02-16 10:48 编辑
我的python代码,不管用,请各位帮帮我- #-*-coding:cp936-*-
- import urllib,urllib2
- values={'strWhere':'主分类号=(a61%)','strPage':'5','area':'cn','strStartPage':'1','uname':'guest','pwd':'',\
- 'uid':'','sessionid':'D1F2B7D0F863C6CEBA96F84E196BD4B4','strStat':'','iOption':'2','iHitPointType':'115','index':'7'}#,'lengpair':'%s|%s'%(lin,lout)}
- url='http://search.cnipr.com/search.do?method=post'
- data=urllib.urlencode(values)
- req=urllib2.Request(url,data)
- req.add_header('User-Agent', "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)")
- response=urllib2.urlopen(req)
- outfile=open('new1.html','w')
- outfile.write(response.read())
- outfile.close()
- raw_input('finished')
复制代码 网页源代码
在附件
search[1].rar
(8.42 KB, 下载次数: 12)
|
|