当前位置: 首页 > 工具软件 > Python Plan > 使用案例 >

用python写爬取图片代码

冀望
2023-12-01

这是一段爬取图片的代码示例:

import requests
from bs4 import BeautifulSoup

url ='https://www.example.com/images'
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')

img_tags = soup.find_all('img')
urls = [img['src'] for img in img_tags]

for url in urls:
    response = req
 类似资料: