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
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
> > 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
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
> >
> > 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):
> >
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
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
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>
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.
for index in range(N):
fid[index] = open('data%d.txt' % index,'r