I have a code to get only integers from a list:
list = [i for i in list if isinstance(i, int)]
However, if the list is [True, 19, 19.5, False]
, it will return [True, 19, False].
I need it to return only [19]
, not the True
and False
. How do I do that?