Issue
How can the last part and slash of an URL be removed?
For example, for the following:
http://localhost/browser/Folder/Folder2/Folder3/last_element.txt
After removing the last element and slash, should become:
http://localhost/browser/Folder/Folder2/Folder3
Solution
U may try this
url = "http://localhost/browser/Folder/Folder2/Folder3/the%20end%20xd.txt"
url = url[:url.rfind('/')]
Answered By - Binayak Chatterjee
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.