3 ways to download file in Python
Mohamad's interest is in Programming (Mobile, Web, Database and Machine Learning). He is studying at the Center For Artificial Intelligence Technology (CAIT), Universiti Kebangsaan Malaysia (UKM).
[1] Using requests
import requests
URL = "https://archive.org/download/embeddingmodel/GoogleNews-vectors-negative300.bin.gz"
response = requests.get(URL)
open(URL.split('/')[-1], "wb").write(response.content)
[2] Using wget
pip install wget
URL = "https://archive.org/download/embeddingmodel/GoogleNews-vectors-negative300.bin.gz"
response = wget.download(URL,URL.split('/')[-1])
[3] Using urllib
pip install urllib
from urllib import request
URL = "https://archive.org/download/embeddingmodel/GoogleNews-vectors-negative300.bin.gz"
response = request.urlretrieve(URL,URL.split('/')[-1])