python下载图片到本地路径
作者:互联网
import requests
from urllib.request import urlretrieve
IMAGE_URL = "http://47.104.63.70:5728/oauth2/captcha.jpg"
#使用urlretrieve来下载图片
# urlretrieve(IMAGE_URL,'D:\\yunduan_pyzdh\\yzm\\00.jpg')
#使用requests直接get
import requests
r = requests.get(IMAGE_URL)
with open('D:\\yunduan_pyzdh\\yzm\\02.jpg', 'wb') as f:
f.write(r.content)
标签:python,IMAGE,路径,jpg,URL,urlretrieve,本地,import,requests 来源: https://www.cnblogs.com/yusilu-2653144/p/16185597.html