[Tutor] a quick Q: how to use for loop to read a series of files with .doc end

Prasad, Ramit ramit.prasad at jpmorgan.com
Fri Oct 7 18:39:49 CEST 2011

> open(base+OUTFILEEXT,"w").write(str(summary))
Unless Python3 is different with respect to files, I would really change this to explicitly close the file. In general, I think explicitly closing resources (database connections, files, etc) are a Good Thing.

with open(base+OUTFILEEXT,"w") as f:


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

More information about the Tutor mailing list