19.9. Exercises
19-1. urllib Module and Files. Update the friends3.py script so that it stores names and corresponding number of friends into a 2-column text file on disk and continues to add names each time the script is run.
EXTRA CREDIT: Add code to dump the contents of such a file to the Web browser (in HTML format). Additional EXTRA CREDIT: Create a link that clears all the names in this file.
19-2. urllib Module. Write a program that takes a user-input URL (either a Web page or an FTP file, i.e., http://www.python.org or ftp://ftp.python.org/pub/python/README, and downloads it to your machine with the same filename (or modified name similar to the original if it is invalid on your system). Web pages (HTTP) should be saved as .htm or .html ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access