Filtering Lists : List Comprehension : List PYTHON TUTORIALS


PYTHON TUTORIALS » List » List Comprehension »

 

Filtering Lists


li = ["a""mpilgrim""foo""b""c""b""d""d"
print [elem for elem in li if len(elem1]    
print [elem for elem in li if elem != "b"]           
print [elem for elem in li if li.count(elem== 1]



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo List
» List Comprehension