I have an array which is like [0 0 0],[3 3 3],[255 255 255](the numbers are RGB values) and I want to remove all the items that has the values [0 0 0] and as result-->[3 3 3],[5 5 5]. So as to implement my different algorithms first of all I have to make my array a list(using .tolist method) and it returns me a list like that:"[0, 0, 0]","[3,3,3]","[255, 255, 255]". So 1st question:Is there any difference between [0 0 0] and "[0, 0, 0]"?
In addition I have use different algorithms as proposed in many topics here like:
for n,i in enumerate(mylist)
if 0 in i: mylist[n].remove(0)
or
def clear_list_from_item(mylist, item):
try:
while True: mylist.remove(item)
except ValueError:
return mylist
mylist = [clear_list_from_item(x, 0) for x in mylist]
And none of them is returning a result. So my 2nd question: Why?Is it because of my list, because when I apply it let's say in list like a =[[3,4],[5],[6,7,8]] all of them work great.
update:1)Level of nesting:269x562(i.e the heightxwidth of the pic that I am working with so I get a list for each pixel) 2)My initial array of 18 values of the first row of the array before .tolist() method
[[ 0 0 0]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[250 250 250]
[255 255 255]
[255 255 255]
[255 255 255]
[255 255 255]
[ 0 0 0]
[ 0 0 0]
[ 0 0 0]
[ 0 0 0]
[ 0 0 0]
[ 0 0 0]
[ 0 0 0]
[ 0 0 0]