[docs] [issue13779] os.walk: bottom-up

Zbyszek Szmek report at bugs.python.org
Mon Jan 16 17:36:40 CET 2012


Zbyszek Szmek <zbyszek at in.waw.pl> added the comment:

>>> os.makedirs('/tmp/a/b/c')
>>> gen  = os.walk('/tmp/a')
>>> next(gen)
('/tmp/a', ['b'], [])
>>> os.makedirs('/tmp/a/b2')
>>> next(gen)
('/tmp/a/b', ['c'], [])
>>> next(gen)
('/tmp/a/b/c', [], [])

>>> gen  = os.walk('/tmp/a', onerror=print)
>>> next(gen)
('/tmp/a', ['b2', 'b'], [])
>>> os.rmdir('/tmp/a/b2')
>>> next(gen)
[Errno 2] No such file or directory: '/tmp/a/b2'
('/tmp/a/b', ['c'], [])

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13779>
_______________________________________


More information about the docs mailing list