excluding

this grabs directories, minus the ones you want to exclude, sorts

folders = next(os.walk('.'))[1]
excluded = ['nope',
            'nada',
            'nunca'
            ]
folders = [f for f in folders if f not in (excluded)]
folders = sorted(folders)

Comments