"With" statement in Python with multiple files to handle.

Posted by systempuntoout on Stack Overflow See other posts from Stack Overflow or by systempuntoout
Published on 2010-05-17T09:35:39Z Indexed on 2010/05/17 9:40 UTC
Read the original article Hit count: 157

Filed under:
|

How do i use the with statement in this case?

f_spam = open(spam,'r')
f_bar = open(eggs,'r')
...
do something with these files
...
f_spam.close()
f_bar.close()

© Stack Overflow or respective owner

Related posts about python

Related posts about best-practices