parsing directory for certain filetypes
roygeorget at gmail.com
Tue Mar 11 06:21:48 CET 2008
On Mar 10, 8:03 pm, Tim Chase wrote:
> In Python2.5 (or 2.4 if you implement the any() function, ripped
> from the docs), this could be rewritten to be a little more
> flexible...something like this (untested):
that was quite a good lesson for a beginner like me..
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?
More information about the Python-list