lst=[1,2,3,4,5] lst2=[item for item in lst if <condition>] # generates a list based on another list and an if statement. the code above is a replacement for: lst=[1,2,3,4,5] lst2=[] for item in lst: if <condition>: lst2.append(item)