messy_list = ["a", 2, 3, 1, False, [1, 2, 3]]
for items in messy_list:
if items.isdigit() == 0:
messy_list.remove(items)
请帮我这样做吗?
你可以做这样的事情(不是就地(:
lst = [item for item in messy_list if isinstance(item, int) and not isinstance(item, bool)]