"takayuki" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> fin = open('animals.txt')
>     for line in fin:

You can write this as:

for line in open('animals.txt'):
    #do stuff

Of course, you can't explicitly close the file this way, but that probably 
doesn't matter. Another way, I think, is to wrap the for loops in this:

with open('animals.txt') as file:
    #for loop stuff here 


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

Reply via email to