#coding:utf-8
import requests

def request_big_data(url):
    name = url.split('/')[-1]
    r = requests.get(url,stream=True) #stream =True 设置为流读取
    with open("download/{}".format(name),'wb') as fd:
        for chunk in r.iter_content(chunk_size=1024):
            if chunk:fd.write(chunk)

request_big_data("http://www.test.com/test.md")

  

 posted on 2024-01-31 10:18  boye169  阅读(68)  评论(0编辑  收藏  举报