Why is this only returning some of the items?
lst = ["!apple", "!green", "!blue", "one"]
new_list = [lst.pop(idx) for idx,i in enumerate(lst) if i.startswith("!")]
print(new_list)
Returns:
['!apple', '!blue']
Why is this only returning some of the items?
lst = ["!apple", "!green", "!blue", "one"]
new_list = [lst.pop(idx) for idx,i in enumerate(lst) if i.startswith("!")]
print(new_list)
Returns:
['!apple', '!blue']