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.

folders= ['1','2','3']
for x in folders:
   print x     # print the current folder
   filename='Folder/%s/myfile.txt' %[x]
   f=open(filename,'r')

gives: IOError: [Errno 2] No such file or directory: "Folder/['1']/myfile.txt"



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
    f=open(filename,'r')

it says: IOError: [Errno 2] No such file or directory:
'Folder/1/myfile.txt'


I believe it's because x is the position marker what you want instead is
the contents of folders at x; therefore folders[x]
HTH,
Tim




--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to