Skip to content

Instantly share code, notes, and snippets.

@mikezhuyuan
Created May 27, 2012 11:53
Show Gist options
  • Save mikezhuyuan/2810241 to your computer and use it in GitHub Desktop.
Save mikezhuyuan/2810241 to your computer and use it in GitHub Desktop.
python download file
import urllib2
BUFFER_SIZE = 256*1024
url = 'http://downloads.sourceforge.net/project/pydev/pydev/PyDev%202.5.0/PyDev%202.5.0.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpydev%2Ffiles%2F&ts=1338118912&use_mirror=nchc'
res = urllib2.urlopen(url)
with open('PyDev.zip', 'wb') as f:
while True:
chunk = res.read(BUFFER_SIZE)
if(not chunk):
break
f.write(chunk)
print len(chunk)
@AbdulRehman1477
Copy link

Great...

@Amiralinaderipour
Copy link

Great...

@khdogsoyx
Copy link

Nice

@Clexader
Copy link

Clexader commented Oct 5, 2022

sorry, but can someone explain how this code works?

@Dhoniks
Copy link

Dhoniks commented Jan 19, 2024

how?

@Dhoniks
Copy link

Dhoniks commented Jan 19, 2024

download file.py

@pal332
Copy link

pal332 commented Apr 5, 2024

Download

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment