The program I am currently working on retrieves URLs from a website and puts them into a list. What I want to get is the last section of the URL.
So, if the first elemen
Just use string.split:
url = "/some/url/with/a/file.html" print url.split("/")[-1] # Result should be "file.html"
split gives you an array of strings that were separated by "/". The [-1] gives you the last element in the array, which is what you want.