import requests
import os
url=' '
root =' '
path=root+' .jpg'
try:
if not os.path.exists(root):
os.mkdir(root)
if not os.path.exists(path):
r=requests.get(url)
with open(path,'wb') as f:
f.write(r.content)
f.close()
else :
print("all ok")
except:
print("no")
使用requests 库爬取百度图片
猜你喜欢
转载自blog.csdn.net/weixin_44724691/article/details/105277846
今日推荐
周排行