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/

posted on 2019-02-24 11:12  代码风云  阅读(146)  评论(0编辑  收藏  举报

导航