Filter List in Python

lst = ['a', 'b', 'c']
filter_list = list(filter(lambda s: s in ('a', 'b'), lst))

print(filter_list) # ['a', 'b']

Recommended Posts

Filter List in Python
Sorted list in Python
List find in Python
[Python] list
Getting list elements in Python
Extract multiple list duplicates in Python
Difference between list () and [] in Python
[python] Manage functions in a list
Delete multiple elements in python list
Quadtree in Python --2
Python in optimization
Metaprogramming in Python
Python 3.3 in Anaconda
Geocoding in python
SendKeys in Python
Meta-analysis in Python
Unittest in python
Epoch in Python
Discord in Python
Sudoku in Python
DCI in Python
quicksort in python
nCr in python
N-Gram in Python
Programming in python
Plink in Python
Constant in python
Lifegame in Python.
FizzBuzz in Python
Sqlite in python
Python> Comprehension / Comprehension> List comprehension
StepAIC in Python
N-gram in python
LINE-Bot [0] in Python
Csv in python
Disassemble in Python
Reflection in Python
Constant in python
nCr in Python.
format in python
Scons in Python3
Puyo Puyo in python
python in virtualenv
PPAP in Python
Quad-tree in Python
Reflection in Python
Chemistry in Python
Hashable in python
Python list manipulation
DirectLiNGAM in Python
LiNGAM in Python
Flatten in python
flatten in python
Display a list of alphabets in Python 3
OR the List in Python (zip function)
Difference between append and + = in Python list
Rewrite SPSS Modeler filter nodes in Python
Download images from URL list in Python
Summary of built-in methods in Python list
Get the EDINET code list in Python
[Python] Understand list slicing operations in seconds