Filter a list in python get integers

>>> x = ['Jack', 18, 'IM-101', 99.9]
>>> [e for e in x if isinstance(e, int)]
[18]

Leave a Comment