This article describes the Python implementation method of extracting filenames from URL addresses. Share to everyone for your reference. The specific analysis is as follows:
such as: Address for http://www.3lian.net/images/logo.gif to extract logo.gif from this address, only need a code to be able to handle?
|1 2 3 4||Import os url = ' logo.gif ' filename = os.path.basename (URL) print (filename)|
The output is:
I hope this article will help you with your Python programming.