lambda seems to be convenient, but I don't know where to use it I was a bad programmer, but I thought this usage would be quite convenient, so I made a note.
How to use Python anonymous functions (lambda) --Life with Python
python
#Define the list appropriately
l = [ "abcde", "bcdef", "cdefg" ]
import re
#Extract only matching data
print filter( lambda x: re.search("bc", x), l )
# ['abcde', 'bcdef']
It can be applied like this even with a map. This is Bene.
Recommended Posts