[Tutor] WRITING XLS FROM OS.WALK()
alan.gauld at btinternet.com
Sun Oct 10 10:17:38 CEST 2010
"Steven D'Aprano" <steve at pearwood.info> wrote
>> Only if glob now descends into the file system... which is why
>> choose os.walk instead.
> Do you mean you want to point at a single directory and have it
> 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
> 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
and glob to build the file list at each level. Each tool has its
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!.
Author of the Learn to Program web site
More information about the Tutor