I have strings in my python application that look this way:
test1/test2/foo/
Everytime I get such a string, I want to reduce it, beginning from the tail and reduced until the fist "/" is reached.
test1/test2/
More examples:
foo/foo/foo/foo/foo/ => foo/foo/foo/foo/
test/test/ => test/
how/to/implement/this => how/to/implement/
How can I implement this in python?
Thanks in advance!