remove empty elements from the list

list2 = list(filter(None, list1))

Where list1 is the original array and list2 is the processed array

Guess you like

Origin blog.csdn.net/JingpengSun/article/details/132197997