python filter

阅读 98

2023-01-16


a = [1, 2, 3, 4, 5, 6]
b = filter(lambda x: x % 2 == 1, a)
print(list(b))

[1, 3, 5]


相关推荐

精彩评论(0)

0 0 举报