I have a utility to delete a list of projects, but I want to know how I can add a black list filter of projects not to delete.
This is what I have right now, I run the script a few times changing the if "Languages" in project: line to delete different projects.
projects = get_projects()
# black_list = [some list of projects that I would like to delete but don't have an exact file name (i.e. "order-*")]
for project in projects:
if "Languages" in project:
import re black_list_of_regex = ['order-.*', 'normal_name'] print([project for project in projects for reg in black_list_of_regex if re.match(reg, project)])
Remember if you want to match full name you should use start/end string regexp
$ in your regular expressions
Hope it helps