bruno modulix wrote: > Here's a somewhat more pythonic version: > > filelist = os.listdir(path) > for filename in filelist: > # I assume you want to remember what's the ext is > ext = os.path.splitext(filename)
Check the docs[1]. This should probably read: _, ext = os.path.splitext(filename) because splitext returns a pair of (root, ext). > # debug trace > print "filename : %s - ext : %s" % (filename, ext) > if ext in ['.this', '.that', '.whatnot']: > print "ext is %s - should process this file" % ext STeVe [1] http://docs.python.org/lib/module-os.path.html -- http://mail.python.org/mailman/listinfo/python-list