py下载网络图片

很简单,做下记录

import urllib
import os

url = "图片路径"

dir = "d:\pyimgtest\G0000001\"

if not os.path.exists(dir):
    os.makedirs(dir)
    print 'not exist and create'


res2 = urllib.urlretrieve(url,dir + os.path.basename(url));

py3:

import urllib.request

urllib.request.urlretrieve(..

 转载请注明博客出处:http://www.cnblogs.com/cjh-notes/

原文地址:https://www.cnblogs.com/cjh-notes/p/10425594.html