On 9 June 2011 20:49, B G <compbiocancerresearc...@gmail.com> wrote: > I'm trying to analyze thousands of different cancer datasets and run the > same python program on them. I use Windows XP, Python 2.7 and the IDLE > interpreter. I already have the input files in a directory and I want to > learn the syntax for the quickest way to execute the program over all these > datasets. > > As an example,for the sample python program below, I don't want to have to > go into the python program each time and change filename and countfile. A > computer could do this much quicker than I ever could. Thanks in advance! >
OK, so make a function of the current program logic for a single filename, and make the base filename a parameter to that function. Then write another function (or main program) that iterates over your directory tree and calls the processing function for each input file. See documentation for module os, specifically os.walk(). (See here: http://docs.python.org/library/os.html ) If that doesn't get you going then post back again. Walter
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor