[Tutor] Parsing data from a set of files iteratively

Prasad, Ramit ramit.prasad at jpmorgan.com
Fri May 18 20:33:05 CEST 2012

>I have a set of ~500 files which I would like to run a script on. My script extracts certain information and 
>generates several lists with items I need. For one of these lists, I need to combine the information from all 
>500 files into one super-list. Is there a way in which I can iteratively execute my script over all 500 files 
>and get them to write the list I need into a new file? Many thanks in advance for your time.

Yes, it is possible. Have you made an attempt? Do you have some working 
or non-working code?

The Python tutorials will help as will the online documentation
How to get a list of files: http://docs.python.org/library/glob.html 
How to read/write a file: http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files 

Hopefully that will give you a start.


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