Я вижу, что память используется для хранения при загрузке файла.Есть ли способ зафиксировать данные после каждого загруженного фрагмента данных объемом 1 ГБ?
![Memory Usage can reach to 90%](https://i.stack.imgur.com/PVrr0.png)
submission_path = r'D:\Users\Jonathan\Desktop\Reddit Data\ETL-Python\\'
for download_file in clean_matching_list_of_href:
save_file_w_submission_path = submission_path + download_file
constructured_url = url_to_download + download_file
request = urllib.request.Request(constructured_url)
response = urllib.request.urlopen(request)
data_content = response.read()
shutil.copyfileobj(save_file_w_submission_path,data_content,length = 10000)
Обновление: Итак, явместо этого использовали запись следующим образом:
for download_file in matching_list_of_href:
filename = download_file[download_file.rfind("/")+1:]
save_file_w_submission_path = path_to_save_document + filename
request = urllib.request.Request(download_file)
response = urllib.request.urlopen(request)
data_content = response.read()
with open(save_file_w_submission_path, 'wb') as wf:
wf.write(data_content)
print(save_file_w_submission_path)