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

相關文章
相關標籤/搜索