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"] ]
Try:
a_list = [["a", ""], ["b", "2"]]
a_list = [l for l in a_list if "" not in l]
print(a_list)
Prints:
[['b', '2']]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With