I\'m trying to build a function that will remove all the files that start with \'prepend\' from the root of my project. Here\'s what I have so far
def cleanu
I would try something like this (which also works on Windows, though I'm guessing that's not a concern for you:
def cleanup(prepend):
prepend = str(prepend)
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
for file_to_delete in [file for file in os.listdir(PROJECT_ROOT) if file.startswith(prepend)]:
os.remove(file_to_delete)