I am getting above error when I am trying to remove .zip files from my directory list
>>> from os import listdir
>>> from os.path import isfile,join
>>> dr = listdir(r"C:\Users\lenovo\Desktop\ronit")
>>> dr
output:
['7101', '7101.zip', '7102', '7102.zip', '7103', '7103.zip']
Now for removing .zip files I wrote following code:
>>> dr.remove("*.zip")
output:
Traceback (most recent call last):
File "<pyshell#18>", line 1, in <module>
dr.remove("*.zip")
ValueError: list.remove(x): x not in list
where am I going wrong?
"*.zip"is not in your list...names = [x for x in names if x is not None or '00000']Id frankly like to clean this up the whole thing isnames= list(df_ora['CODE'].unique()) names.append("00000") names = [x for x in names if x != None] names = [x for x in names if x != '00000']