Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

remove list from list python

a = ['apple', 'carrot', 'lemon']
b = ['pineapple', 'apple', 'tomato']

# This gives us: new_list = ['carrot' , 'lemon']
new_list = [fruit for fruit in a if fruit not in b]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #list #list #python
ADD COMMENT
Topic
Name
4+1 =