Fred,

What is/are the exact error message(s)?

You may want to look at the module glob.

Steve



Ar e you typing this in the python interpreter or
On Aug 1, 2008, at 10:41 PM, Fred @ Mac wrote:

Hello,

new to python, so please go easy on me!

I am using

for f in os.listdir(watch_dir):
       tree = ET.parse(f)
       for shot in tree.findall('Shot'):
                ..do stuff..

to scan a directory for specific files (xml files specifically).

But my script fails if, for example, a directory also exists in "watch_dir"

How can i restructure this so it only returns a list of the .xml files in that directory, ignores other files and or directories in "watch_dir"

Thanks!

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

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

Reply via email to