On Thu, Jul 2, 2015 at 5:24 AM, <zljubi...@gmail.com> wrote: > with urllib.request.urlopen(req) as response, open(lfile, 'ab') as > out_file: > data = response.read() # a `bytes` object > out_file.write(data) >
If a file is big enough to want to resume the download once, you almost certainly want to be able to resume it a second time. I would recommend not attempting to do the entire read and write as a single operation - read chunks and write them to the disk. This will attempt to read the entire response into a gigantic in-memory bytestring, and only then start writing. ChrisA -- https://mail.python.org/mailman/listinfo/python-list