from urllib.request import urlretrieve
from urllib.request import urlopen
from bs4 import BeautifulSoup

#下载文件demo

html = urlopen("http://www.pythonscraping.com")
bsObj = BeautifulSoup(html,"html.parser")
imageLocation = bsObj.find("a",{"id":"logo"}).find("img")["src"]
urlretrieve(imageLocation,"logo.jpg")


彪悍大蓝猫
67 声望3 粉丝

代码搬运工