We need to import the os module to delete the file.Syntax :import osos.remove(filename)
Syntax :
import os
os.remove(filename)