import requests
def image():
# 获取url
url = 'https://img1.baidu.com/it/u=1567939675,133625208&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500'
# 模拟浏览器发送请求
respond = requests.get(url).content
# 数据持久化
fileName = '图片.jpg'
with open(fileName,'wb+') as f:
f.write(respond)
print('爬取图片成功!')
image()
爬虫基础之爬取图片
最新推荐文章于 2024-11-02 19:50:02 发布