import requests from bs4 import BeautifulSoup

url = "http://www.gzrea.org.cn/website/website_scyj_scyjList.action?pdid=201"

response = requests.get(url) soup = BeautifulSoup(response.content, "html.parser")

image_urls = []

for img in soup.find_all("img"): image_urls.append(img["src"])

for i, url in enumerate(image_urls): response = requests.get(url) with open(f"image_{i}.jpg", "wb") as f: f.write(response.content) print(f"Downloaded {url} as image_{i}.jpg")

编写一段关于自动抓取网址图片数据的Python语言网址地址为httpwwwgzreaorgcnwebsitewebsite_scyj_scyjListactionpdid=201

原文地址: https://www.cveoy.top/t/topic/eC5k 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录