"ingo" <ingoo...@gmail.com> wrote
at the os.walk() function for traversing directory trees? It may be
all
you need.
Yes, but I'm not confident with it (the more reason to use it you
will say :) ).
Quite. A simple tree printout looks like this:
for t in os.walk('Root'):
... print t
...
And the result is:('Root', ['D1', 'D2', 'D3'], ['FA.txt', 'FB.txt'])
('Root/D1', ['D1-1'], ['FC.txt'])
('Root/D1/D1-1', [], ['FF.txt'])
('Root/D2', [], ['FD.txt'])
('Root/D3', ['D3-1'], ['FE.txt'])
('Root/D3/D3-1', [], ['target.txt'])
That's a lot of work done for just 2 lines of code...Thats taken
from the OS topic in my tutorial(V2 only as yet)It goes into
slightly more detail and more examples.But it looks like it will
sace you a lot of work!
-- Alan GauldAuthor of the Learn to Program web
sitehttp://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor