"Nick Burgess" <burgess.n...@gmail.com> wrote

for root, dirs, files in os.walk('./'):
    for f in files:
        if f.endswith('.txt'):
            allfiles.append(os.path.join(root, f))
              myFunction( os.path.join(root,f) )

This returns a list of the *.txt files. Of course now I am stuck on
how to apply the delimiter and search function to the items in the
list..?

Either call your function on each file as you find it -- no need for a list, or...

for f in allfiles:
     myFunction(f)

Provided your function can take the filename as a parameter either method will work.

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to