a_list = [ ["a", ""], ["b", "2"] ] I have a list of lists as written above. Any suggestions on how to remove the row that contains an empty element (in this case the first list), without using pandas, so it returns:
a_list = [ ["b", "2"] ] To check at specific index too
Here in your case you're check list[xx][1] index
solution-1
#Devil a_list = [["a", ""], ["b", "2"]] a_list = [l for l in a_list if l[1] != ""] print(a_list) solution 2
Use another array and append the data init
new = [] for i in l: if i[1] != "": new.append(i) print(new)