NOTE: Please, don't code it for me. I already have a home-rolled function to do what I describe below.
Is there a function in the standard Python library that will take an absolute path as argument, and return a tuple of all its "atomic" path components, after removing all redundant ones (e.g. ./
), resolving bits like ../
, etc.? For example, given the Unix path /s//pam/../ham/./eggs
, the output should be
('/', 's', 'ham', 'eggs')
and given the Windows path C:\s\\pam\..\ham\.\eggs
, the output should be
('C:', '\\', 's', 'ham', 'eggs')
Thanks!