10.17(2)

不问归期 提交于 2020-02-18 08:29:27
import reimport urllibdef get_content(url):    '''doc.'''    html = urllib.urlopen(url)    content = html.read()    html.close()    return contentdef get_image(info):    '''doc.'''    regex = r'class="BDE_Image" src="(.+?\.jpg)"'    pat = re.compile(regex)    image_code = re.findall(pat,info)    i = 0    for image_url in image_code:        print image_url        urllib.urlretrieve(image_url,'%s.jpg'%i)        i += 1    return image_codeurl = 'https://tieba.baidu.com/p/27726566630'info = get_content(url)# print infoprint get_image(info)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!