George Sakkis wrote:
> Or a bit more efficiently (no need to allocate a new list for storing
> files+dirs):
>
> from itertools import chain
> for root, dirs, files in os.walk(path):
> for fs_object in chain(files,dirs):
> ADD fs_object to dictionary
I like that! itertools is
[rtilley]
> When working with file and dir info recursively on Windows XP. I'm going
> about it like this:
>
> for root, dirs, files in os.walk(path):
> for f in files:
> ADD F to dictionary
> for d in dirs:
> ADD D to dictionary
>
> Is it possible to do something such a
rtilley wrote:
> Duncan Booth wrote:
>
>> How about just concatentating the two lists:
>>
>>> for root, dirs, files in os.walk(path):
>>
>>for fs_object in files + dirs:
>>
>>> ADD fs_object to dictionary
>
>
> Thank you Duncan! that solves the problem perfectly!
Or a bit more effi
rtilley wrote:
> Just to clarify. In this particular case, I do not need to differentiate
> between files and dirs... so would it be possible to do something such
> as this:
>
How about just concatentating the two lists:
> for root, dirs, files in os.walk(path):
> for fs_object in files,
rtilley wrote:
> Hello,
>
> When working with file and dir info recursively on Windows XP. I'm going
> about it like this:
>
> for root, dirs, files in os.walk(path):
> for f in files:
> ADD F to dictionary
> for d in dirs:
> ADD D to dictionary
>
> Is it possible to do
Duncan Booth wrote:
> How about just concatentating the two lists:
>
>>for root, dirs, files in os.walk(path):
>for fs_object in files + dirs:
>> ADD fs_object to dictionary
Thank you Duncan! that solves the problem perfectly!
--
http://mail.python.org/mailman/listinfo/python-li
Hello,
When working with file and dir info recursively on Windows XP. I'm going
about it like this:
for root, dirs, files in os.walk(path):
for f in files:
ADD F to dictionary
for d in dirs:
ADD D to dictionary
Is it possible to do something such as this:
for root,