Mega Code Archive

 
Categories / Python Tutorial / Data Type
 

Building a list from another list

L1 = ['spam', 'spam', 'spam', 'A', None, 'spam', 'spam'] L2 = [] for i in L1:     if i is not None:         L2.append(i)