a simple 'for' question
keshet1 at umbc.edu
Wed Jul 9 13:22:08 CEST 2008
it didn't help. it reads the pathway "as is" (see errors for both
tries). It looks like it had the write pathway the first time, but
could not find it because it searched in the path/way instead of in the
path\way. thanks for trying.
for x in folders:
print x # print the current folder
gives: IOError: [Errno 2] No such file or directory:
Tim Cook wrote:
> On Wed, 2008-07-09 at 00:00 -0400, Ben Keshet wrote:
>> oops, my mistake, actually it didn't work...
>> when I tried:
>> for x in folders:
>> print x # print the current folder
>> filename='Folder/%s/myfile.txt' %x
>> it says: IOError: [Errno 2] No such file or directory:
> I believe it's because x is the position marker what you want instead is
> the contents of folders at x; therefore folders[x]
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list