Python download file without external library -


i have large python script using pyinstaller create exe. need download xml file keep exe small possible getting quite large.

is there method within python file url? not able find without external library

you can use urllib.urlretrieve() saves opened page specified path.

alternatively can open url urllib.urlopen() , write read file in binary mode:

import urllib urllib.urlretrieve(url, destination_path) # first , short way  open(destination_path, 'wb') f:   # equivalent first, longer     f.write(urllib.urlopen(url).read()) 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -