今天学习了如何爬取图片:
代码部分:
import requests
from bs4 import BeautifulSoup
url = "https://www.umei.net/"
resp = requests.get(url)
resp.encoding = "utf-8"
#print(resp.text)
main_page = BeautifulSoup(resp.text,"html.parser")
alist = main_page.find("div",class_="PicListTxt").find_all("a")
for a in alist:
href = url+a.get('href').strip('/')
print(href)