We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would something like this be acceptable?
def split_all(path): all_parts = [] while True: parts = os.path.split(path) if parts[0] == path: # sentinel for absolute paths all_parts.insert(0, parts[0]) break elif parts[1] == path: # sentinel for relative paths all_parts.insert(0, parts[1]) break else: path = parts[0] all_parts.insert(0, parts[1]) return all_parts
The text was updated successfully, but these errors were encountered:
I recommend you use pathlib it's part of the standard library in Python 3.4+ and it's been backported to earlier python.
pathlib
You just do pathlib.Path(path).parts to get this functionality.
pathlib.Path(path).parts
Sorry, something went wrong.
Thank you.
No branches or pull requests
Would something like this be acceptable?
The text was updated successfully, but these errors were encountered: