草稿 · 2022年5月1日 0

草稿:Python 剔除列表中的空元素

实例元素:

list1 = ["first", "", "second"]

方法1:

method1 = [x for x in list1 if x]