On 7/28/2011 1:18 PM gry said...
[python 2.7] I have a (linux) pathname that I'd like to split
completely into a list of components, e.g.:
    '/home/gyoung/hacks/pathhack/foo.py'  -->   ['home', 'gyoung',
'hacks', 'pathhack', 'foo.py']

os.path.split gives me a tuple of dirname,basename, but there's no
os.path.split_all function.


Why not just split?

'/home/gyoung/hacks/pathhack/foo.py'.split(os.sep)

Emile

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to