python爬虫模拟登录之验证码
jopen
9年前
#coding:utf8 import urllib2 import cookielib url = ' #以上是动态生成验证码的网址 cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) urllib2.install_opener(opener) response = urllib2.urlopen(url) html = response.read() f = open('/root/Desktop/test.jpg','wb') #写入本地一个文本,ok f.write(html) f.close()