li = ["a", "mpilgrim", "foo", "b", "c", "b", "d", "d"]
print([elem for elem in li if len(elem)>1])
print([elem for elem in li if elem != "b"])
print([elem for elem in li if li.count(elem) == 1])
micropython的list应用
最新推荐文章于 2024-04-05 15:11:23 发布
li = ["a", "mpilgrim", "foo", "b", "c", "b", "d", "d"]
print([elem for elem in li if len(elem)>1])
print([elem for elem in li if elem != "b"])
print([elem for elem in li if li.count(elem) == 1])