On Mar 11, 12:21 am, royG <[EMAIL PROTECTED]> wrote: > On Mar 10, 8:03 pm, Tim Chase wrote: > in the version using glob() > > >path = os.path.normpath(os.path.join(folder, '*.txt')) > >lst = glob.glob(path) > > is it possible to check for more than one file extension? here i will > have to create two path variables like > path1 = os.path.normpath(os.path.join(folder, '*.txt')) > path2 = os.path.normpath(os.path.join(folder, '*.doc')) > > and then use glob separately.. > or is there another way?
use a loop. (untested) def parsefolder(folder): lst = [] for pattern in ('*.txt','*.doc'): path = os.path.normpath(os.path.join(folder, pattern)) lst.extend(glob.glob(path)) lst.sort() return lst -- http://mail.python.org/mailman/listinfo/python-list