from pathlib import Path def main(args): for item in args: Path(args).unlink(missing_ok=True) # missing_ok=True prevents error if file is missing