you need to write this image data to file on the hard drive you'll need filename for the local image file to pass to open(the comicurl will have value like '_explanation png'--which you might have noticed looks lot like file path and in factyou can call os path basename(with comicurland it will return just the last part of the url'heartbleed_explanation pngyou can use this as the filename when saving the image to your hard drive you join this name with the name of your xkcd folder using os path join(so that your program uses backslashes (\on windows and forward slashes (/on macos and linux now that you finally have the filenameyou can call open(to open new file in 'wb"write binarymode remember from earlier in this that to save files you've downloaded using requestsyou need to loop over the return value of the iter _content(method the code in the for loop writes out chunks of the image data (at most , bytes eachto the file and then you close the file the image is now saved to your hard drive afterwardthe selector ' [rel="prev"]identifies the element with the rel attribute set to prevand you can use this element' href attribute to get the previous comic' urlwhich gets stored in url then the while loop begins the entire download process again for this comic the output of this program will look like thisdownloading page downloading image downloading page downloading image downloading page downloading image downloading page downloading image downloading page downloading image downloading page downloading image --snip-this project is good example of program that can automatically follow links in order to scrape large amounts of data from the web you can learn about beautiful soup' other features from its documentation at ideas for similar programs downloading pages and following links are the basis of many web crawling programs similar programs could also do the following back up an entire site by following all of its links copy all the messages off web forum duplicate the catalog of items for sale on an online store