I have a string that has the path of the file stored in it.
path = \home\linux\testfile\abc\work
now I want to write a function with which I can remove all the characters occurring after the last '\\'
.
So,
new_path = \home\linux\testfile\abc
Is there a way I can do it? Slicing doesn't help because the number of characters after the last '\' isn't fixed. I know i need to post an attempt but i don't even understand how do i start this.