I am trying to delete all xlsx
files from a folder, note it has files of other extension. Given below is what I have tried:
path = '/users/user/folder'. <-- Folder that has all the files
list_ = []
for file_ in path:
fileList = glob.glob(path + "/*.xlsx")
fileList1 = " ".join(str(x) for x in fileList)
try:
os.remove(fileList1)
except Exception as e:
print(e)
But the above does not delete the xlsx files.