I have a simple for loop iterating over a list of items. At some point, I know it will break. How can I then return the remaining items?
for i in [a,b,c,d,e,f,g]:
try:
some_func(i)
except:
return(remaining_items) # if some_func fails i.e. for c I want to return [c,d,e,f,g]
I know I could just take my inital list and delete the the items from the beginning for every iteration one by one. But is there maybe some native Python function for this or something more elegant?