"Steven D'Aprano" <st...@pearwood.info> wrote
Only if glob now descends into the file system... which is why
you'd
choose os.walk instead.
Do you mean you want to point at a single directory and have it
search
any and all subdirectories, no matter how deeply nested? Well, yes,
that would be a good use-case for os.walk, and yes, I completely
missed
it, so I withdraw my comment that Susana had re-invented the wheel.
I think the solution should use both. os.walk to traverse the
directories
and glob to build the file list at each level. Each tool has its
role.
I didn't see anything untoward in recommending glob to replace
the use of the string based list comp for selection of the files,
I just assemed you meant in conjunction with os.walk!.
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor