download file using python code example
Example 1: how to download file from python
import wget
url = "https://www.python.org/static/img/[email protected]"
wget.download(url,
Example 2: how to download file in python
import urllib2
filedata = urllib2.urlopen(
datatowrite = filedata.read()
with open(
f.write(datatowrite)
Example 3: how to download file in python
import urllib.request
print(
url =
urllib.request.urlretrieve(url,
Example 4: python get an online file
import urllib2 # the lib that handles the url stuff
data = urllib2.urlopen(target_url) # it
for line in data: # files are iterable
print line