My code:
ipList = ["192.168.0.1", "sg1234asd", "1.1.1.1", "test.test.test.test"]
blackList = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "_", ","]
for ip in ipList:
for item in blackList:
if (item in ip) == True:
ipList.remove(ip)
else:
pass
print ipList
From what I can read of this code, it should print only print ipList elements 0 and 2, why do I get given ValueError: list.remove(x): x not in list
in line 6?