<filename>python_3.8/python_web_scraping_utilities/download_xkcd.py
#! python3
# download every xkcd comic

import requests, os, bs4

url = 'http://xkcd.com'             # starting url
os.makedirs('xkcd', exist_ok=True)  # store comics in ./xkcd

while not url.endswith('#'):
    # download page
    print('Downloading page %s...' % url)
    res = requests.get(url)
    res.raise_for_status()




    soup = bs4.BeautifulSoup(res.text)
print('Done.')
<filename>python_3.8/python_web_scraping_utilities/download_xkcd.py
#! python3
# download every xkcd comic

import requests, os, bs4

url = 'http://xkcd.com'             # starting url
os.makedirs('xkcd', exist_ok=True)  # store comics in ./xkcd

while not url.endswith('#'):
    # download page
    print('Downloading page %s...' % url)
    res = requests.get(url)
    res.raise_for_status()




    soup = bs4.BeautifulSoup(res.text)
print('Done.')
#! python3 # download every xkcd comic # starting url # store comics in ./xkcd # download page