get text from url python last slash

#From stacoverflow:
url = 'http://www.test.com/TEST1'
last = url.rsplit('/', 1)[-1]
print(last) #TEST1

Here is what the above code is Doing:
1. Split the string on the last ‘/’
2. Take the last element of the resulting list
3. Print it