python3 delete a file that is in use code example Example: python3 delete file import os os.system(f"rm -rf {filename.txt}")