# -*- coding: utf-8 -*-
import urllib
def DownImg(url, dirPath, name):
fr = urllib.urlopen(url)
stream = fr.read()
fr.close()
fw = open(dirPath+name,'wb') # 图片是二进制 使用wb
fw.write(stream)
fw.close()
print(dirPath+name)
downImg('图片网址连接',"F:\\保存路径\\","图片文件名.jpg")
Python 下载图片函数
最新推荐文章于 2020-12-04 10:25:41 发布