Re: [Numpy-discussion] how to loop read input over various file with same extension in a folder (newbie question)

2011-03-24 Thread Sachin Kumar Sharma
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

Re: [Numpy-discussion] how to loop read input over various file with same extension in a folder (newbie question)

2011-03-24 Thread Paul Anton Letnes
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 a

[Numpy-discussion] how to loop read input over various file with same extension in a folder (newbie question)

2011-03-24 Thread Sachin Kumar Sharma
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