a simple 'for' question
Tim Cook
timothywayne.cook at gmail.com
Wed Jul 9 06:33:50 EDT 2008
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
--
Timothy Cook, MSc
Health Informatics Research & Development Services
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
Skype ID == timothy.cook
**************************************************************
*You may get my Public GPG key from popular keyservers or *
*from this link http://timothywayne.cook.googlepages.com/home*
**************************************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/python-list/attachments/20080709/8aac82d1/attachment.sig>
More information about the Python-list
mailing list