i=0 lst=d for i in range(dl): f=d[i] print f if fnmatch.fnmatch(f,mask): print "ff" else: print "file is not be reader" del lst[1] i=i+1 The lst array duplicates the d array, after the array elements that do not match the mask should be removed, but instead the python is cried by IndexError: list index out of range
and here in this place
f=d[i] Although when deleting this line, everything works
del lst[1] But I need to remove unmatched elements, who knows what the problem is?