[issue33102] get the nth folder of a given path

Eric V. Smith report at bugs.python.org
Wed Mar 21 10:51:24 EDT 2018


Eric V. Smith <eric at trueblade.com> added the comment:

Yes, it's cross platform.

For a plain string version, you can use a utility function:

>>> for i in range(n+1):
...   path = os.path.dirname(path)
...

I'm not sure it's worth adding this to os.path.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33102>
_______________________________________


More information about the Python-bugs-list mailing list