I have the following list of directories and sub-directories.
import glob
zipfiles = 'src/**/**/data.nq.gz'
filelist = glob.glob(zipfiles,recursive = True)
From this list, I need to exclude two directories namely 'src/27/' and 'src/c1/'
How do I do that?
P.S. src is a huge folder that contains tons of directories and subdirectories.
Thanks in advance
This should work:
filelist = [f for f in filelist if f[:7] not in ['src/27/', 'src/c1/']]