import requests
import re
import os
url="https://www.sohu.com/a/25534119_189145"
headers={"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 Edg/97.0.1072.76"}
page_data=requests.get(url=url,headers=headers).text
imgge_src=re.findall('<p>.*?<img src="(.*?)" alt.*?<p>',page_data,re.S)
for src in imgge_src:
img=requests.get(url=src,headers=headers).content
img_name=src.split("/")[-1]
img_path="C:\\Users\\HP\\Desktop\\gaoxiao\\"+img_name
with open(img_path,"wb") as f:
f.write(img)
print(img_name,"下载成功")
08-23
160
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)