Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python list comprehension

#example: removing common elements found in `a` from `b`.
a = [1,2,3,4,5]
b = [5,6,7,8,9]
# desired output: [1,2,3,4]

# gets each item found in `a` AND not in `b`
print([i for i in a if i not in b])
Source by google.github.io #
 
PREVIOUS NEXT
Tagged: #python #list #comprehension
ADD COMMENT
Topic
Name
8+6 =