瞎爬些图

Posted 午夜的行人

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了瞎爬些图相关的知识,希望对你有一定的参考价值。

 1 import urllib
 2 import re
 3 
 4 url = "https://www.duitang.com/search/?kw=%E9%AC%BC%E6%80%AA&type=feed"
 5 page = urllib.urlopen(url)
 6 html = page.read()
 7 
 8 imglist = re.findall(rsrc="(.*?\.(jpg|jpeg))",html)
 9 
10 x=0
11 
12 for imgurl in imglist:
13     urllib.urlretrieve(imgurl[0],/home/zl20163297/test/pachong/pics/guiguai/%d.jpg%x)
14     x+=1

以上是关于瞎爬些图的主要内容,如果未能解决你的问题,请参考以下文章