I have a list
Nodelist1 = [
[['B', 10], ['IN', 1000]],
[['C', 15], ['OUT', 1001]],
[['F', 30], []]
]
I am checking if in list an element with index 1 is empty, If it is empty I want to remove it from the list.
My code is like this:
for i in range(len(Nodelist1)):
if Nodelist1[i][1]==NULL:
print "This node is deleted",Nodelist1[i][0]
Nodelist1.remove(Nodelist1[i][0])
else:
print Nodelist1[i][0]
But this gives me an error:
Nodelist1.remove(Nodelist1[i][0])
ValueError: list.remove(x): x not in list.
Can some one help me here?