I'm trying to remove all elements within a list except those that are integers. I am able to remove strings and booleans but I am unable to remove lists given the code below.
messy_list = ["a", 2, 3, 1, False, [1, 2, 3]]
for idx, val in enumerate(messy_list):
if type(val) != int:
messy_list.pop(idx)
print(messy_list)