import os fhandle = open("install_log.txt","r") for line in fhandle.readlines(): print("deleting ", line[:-1]) os.system("rm -f "+line[:-1])