Answers for "apply boolean to list"

0

apply boolean to list

>>> from itertools import compress
>>> list_a = [1, 2, 4, 6]
>>> fil = [True, False, True, False]
>>> list(compress(list_a, fil))
[1, 4]
Posted by: Guest on June-08-2020

Python Answers by Framework

Browse Popular Code Answers by Language