When downloading content from a URL, we often want to save it in a file. Often it is good enough to save the file in a file with a name found in the URL. But the URL consists of a number of fragments, so how can we find the actual filename from the URL, especially where there are often many parameters after the file name?
Parsing a URL with urllib to get the filename
Getting ready
We will again be using the URLUtility class for this task. The code file for the recipe is 04/02_parse_url.py.
How to do it
Execute the recipe's file with your python interpreter. It...