Why is this: >>> li2 =['this.txt', 'that.txt', 'April04', 'more.txt'] >>> for item in li2: if ".txt" in item: li2.remove("%s" %item) >>> li2 ['that.txt', 'April04'] I would think that 'that.txt' would be removed as well. Where am I wrong? TIA