Mega Code Archive

 
Categories / Python / List
 

Loop through a list

a = ['cat', 'window', 'defenestrate'] for x in a[:]: # make a slice copy of the entire list     if len(x) > 6: a.insert(0, x)   print a