Created
April 26, 2020 15:51
-
-
Save shaabhishek/cc722d24475c0c13d6de168fa39c221f to your computer and use it in GitHub Desktop.
Script to download files in batch mode
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
from urllib.request import urlretrieve | |
from pathlib import Path | |
import time | |
import random | |
slides_dir = Path('/blablabla/CS590M/slides') | |
url = lambda n: f"https://blabla.com/slecture{n:02}h.pdf" | |
fname = lambda n: slides_dir / f"slecture{n:02}h.pdf" | |
urlfname = lambda n: (url(n), fname(n)) | |
for i in range(1, 13): | |
urlretrieve(*urlfname(i)) | |
time.sleep(0.1 + random.random()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment