[Tutor] Syntax for Simplest Way to Execute One Python Program Over 1000's of Datasets

Válas Péter sulinet at postafiok.hu
Fri Jun 10 12:55:57 CEST 2011


2011/6/10 B G <compbiocancerresearcher at gmail.com>

>
> path = "...\\Leukemia_Project"
> i = 0
> for (files) in os.walk(path):
>     print(files)
>     print("\n")
>     i += 1
>

Continuing my thoughts:
I ran your loop, and got several tuples, each representing a directory. All
the tuples have the same structure: 0th element is the name of the
directory, followed by a list of subdirs (possibly empty) and a list of
files (possibly empty). I find no reason to maipulate this by Excel. Try
instead:

def clean(f):
    any processing, removing here

path = ".../Leukemia_Project"
dirlists = []
for (files) in os.walk(path):
    print(files)
    dirlists.append(clean(files))
    print("\n")

Then go on with next step. You will enjoy your work more than with
printing-marking-copying-pasting-saving-opening-processing-saving-reopening...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110610/79d48a51/attachment.html>


More information about the Tutor mailing list