Reputation: 47
I need to remove just filename (Ex.: 'number.pdf') from a URL:
Finally, I'd like get just this:
How Can i do it?
Any idea? Who say I?
Upvotes: 2
Views: 1065
Reputation: 4536
This can be easily done with os.path.dirname()
.
Example:
import os
print(os.path.dirname('http://URL.com/S01/000/users/info/4512.pdf'))
Output:
http://URL.com/S01/000/users/info
Upvotes: 3