Re: file pointer array

2012-06-06 Thread Jon Clements
On 06/06/12 19:51, MRAB wrote: On 06/06/2012 19:28, Jon Clements wrote: On 06/06/12 18:54, Prasad, Ramit wrote: 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 ch

Re: file pointer array

2012-06-06 Thread MRAB
On 06/06/2012 19:28, Jon Clements wrote: On 06/06/12 18:54, Prasad, Ramit wrote: 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. .exten

RE: file pointer array

2012-06-06 Thread Prasad, Ramit
> > 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 eac

Re: file pointer array

2012-06-06 Thread Jon Clements
On 06/06/12 18:54, Prasad, Ramit wrote: 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. Jon. -- http://mail.python.org/mailman/listinfo/pytho

RE: file pointer array

2012-06-06 Thread Prasad, Ramit
> > > > I have a simple question. I wish to generate an array of file pointers. > > For example, I have files: > > > > data1.txt > > data2.txt > > data3.txt > > > > > > I wish to generate fine pointer array so that I can read the files at > > the same time. > > > > for index in range(N): > >

Re: file pointer array

2012-06-04 Thread Steven D'Aprano
On Mon, 04 Jun 2012 18:21:20 -0700, FSH wrote: > Hello, > > I have a simple question. I wish to generate an array of file pointers. > For example, I have files: > > data1.txt > data2.txt > data3.txt > > > I wish to generate fine pointer array so that I can read the files at > the same time

Re: file pointer array

2012-06-04 Thread Chris Rebert
On Mon, Jun 4, 2012 at 6:21 PM, FSH wrote: > Hello, > > I have a simple question. I wish to generate an array of file > pointers. For example, I have files: > > data1.txt > data2.txt > data3.txt > > > I wish to generate fine pointer array so that I can read the files at > the same time. > > f

Re: file pointer array

2012-06-04 Thread Ben Finney
FSH writes: > I have a simple question. I wish to generate an array of file > pointers. Welcome to Python. By your description, I think you want a different type: not an array, but a list. I recommend you become familiar with Python's data model http://docs.python.org/reference/datamodel.html>