On May 4, 5:04 am, Matthew Wilson <[email protected]> wrote:
> Is there already a tool in the standard library to let me walk up from a
> subdirectory to the top of my file system?
Never seen such a standard tool, yet it can be implemented in a way
like this
def walkup(path):
aux = path.rsplit('/')
while aux != ['']:
yield reduce(lambda x,y:x+'/'+y,aux)
aux.pop()
yield '/'
Maybe this is not the best way to ascend directories, but it seems to
work.
--
http://mail.python.org/mailman/listinfo/python-list