file pointer array

Prasad, Ramit ramit.prasad at jpmorgan.com
Wed Jun 6 14:44:20 EDT 2012


> > data= []
> > for index in range(N, 1): # see Chris Rebert's comment
> >      with open('data%d.txt' % index,'r') as f:
> >          data.append( f.readlines() )
> >
> 
> I think "data.extend(f)" would be a better choice.

Wouldn't that concatenate the data from each file
rather than keeping each file's data separate? 

Ramit


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 Python-list mailing list