python 下载图片

def downloadImage(url):url

    local_filename = url.split('/')[-1]get


    r = requests.get(url, stream=True)requests

    with open(local_filename, 'wb') as f:it

        for chunk in r.iter_content(chunk_size=1024):stream

            if chunk:file

                f.write(chunk)request

    return local_filenameco

相关文章
相关标签/搜索