What is a convenient way to resolve the path /bar/foo/baz/../ .. to / bar?

Is there a module capable of doing this, or should I write something myself?

+3
source share
1 answer

How about this:

>>> os.path.normpath("/bar/foo/baz/../..")
"/bar"
+9
source

All Articles