Lets say some paths like these:
C:/Test/path_i_need/test2/test3/test4
C:/Test/test2/path_i_need/test3
C:/Test/test2/test3/path_i_need/test4
How I can extract the path that i need in each of the scenarios using python, for example:
C:/Test/path_i_need
C:/Test/test2/path_i_need
C:/Test/test2/test3/path_i_need
So basically i don't know how many sub folder are before the path_i_need or after it, I only need that path, i dont care whats after.
pathlibfrom the standard libraries.Pathobjects can be used for many path manipulations.