I have a path as '/img/dataset/A/B/3/5/img1.png' How can I extract the '/A/B/3/5/img1.png' part out of this?
I tried
path = '/img/dataset/A/B/3/5/img1.png'
extracted = path.partition('/')
This gave me the whole path as the output.
This should work :
path[len('/img/dataset'):]
Strings share some properties with lists, indexing and len beeing some.