Last active
March 13, 2023 05:20
-
-
Save khalido/a0621620387555ed92c8931c07bcb5e4 to your computer and use it in GitHub Desktop.
[download multiple files using python] and save to data dir #file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exprs__url = "https://github.com/cs109/2014_data/raw/master/exprs_GSE5859.csv" | |
sampleinfo_url = "https://github.com/cs109/2014_data/raw/master/sampleinfo_GSE5859.csv" | |
urls = [exprs__url, sampleinfo_url] | |
filenames = ["exprs_GSE5859.csv", "sampleinfo_GSE5859.csv"] | |
for url, filename in zip(urls, filenames): | |
r = requests.get(url, stream=True) | |
with open("data/"+filename, 'wb') as fd: | |
for chunk in r.iter_content(chunk_size=256): | |
fd.write(chunk) | |
print(f"file {filename} downloaded succesfully") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment