On 25/01/16 21:34, Sam Starfas via Tutor wrote:

> Can the below script be modified to scan/read all of the XML files in a 
> directory

You could do it manually using

for file in glob.glob("*.xml"):

But you need to think about all the other possible file
endings too.

Or you could look at the fileinput module which takes a
different approach.

Finally if you need to process subdirectories too you
can use the os.walk() function

The Python docs describe how to use glob, fileinput
and os.walk.

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to