BartlebyScrivener wrote:
> I don't know if it's "standard," but why not just:
>
> dir = './foo/bar/moo/lar/myfile.txt'
> dir.split('/')
>
> ['.', 'foo', 'bar', 'moo', 'lar', 'myfile.txt']
>
> rd

There's also os.path.sep, from the docs: "The character used by the
operating system to separate pathname components."
But a recursive function like the one Iain King posted is likely the
best way to go.

~Simon

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

Reply via email to