How can I stop the iteration of list comprehension when a particular element is found For example:
list1=[a for a in list2 if a==someelement]
As soon as "a equals someelement",list1 should be set to a and no further iterations should be executed.