Paul, Appreciate your reply.
Cheers Sachin ************************************************************************ Sachin Kumar Sharma Senior Geomodeler -----Original Message----- From: numpy-discussion-boun...@scipy.org [mailto:numpy-discussion-boun...@scipy.org] On Behalf Of Paul Anton Letnes Sent: Thursday, March 24, 2011 3:54 PM To: Discussion of Numerical Python Subject: Re: [Numpy-discussion] how to loop read input over various file with same extension in a folder (newbie question) One way is to use python dicts. Pseudocode: arrays = {} integer = 0 for file in allfiles: integer +=1 data = file.read() arrays['a' + '%d' % integer] = data I would consider using the filename as the key instead of a1, a2, etc. That way you have that information readily available as well. Good luck, Paul. On 24. mars 2011, at 08.27, Sachin Kumar Sharma wrote: > BB, > > Currently I am reading a text file and storing the output as an array a1, > some arithmetic operation on it and plotting it. I want to do the same over > 1000 files. > How to loop it and how to store the input in different arrays like a2, a3 and > so on. > > Also advise what is the best way to TAG or assign a comment to an array to > store which file it has read the data. > > Cheers > > Sachin > > ************************************************************************ > Sachin Kumar Sharma > Senior Geomodeler > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion