How python uses the Filter () filter function
Editor to share with you how python uses the Filter () filter function, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Filter () filter function
The filter () function filters the sequence using the specified function or lambda function. This function returns a filter object, and the filter object is an iterator. In general, the usage of this function is very similar to the map () function.
> def good_word (x: str): Has_vowels = not set ('aeiou') .isdisjoint (x.lower ())... Long_enough = len (x) > 7... Good_start = x.lower (). Startswith ('pre')... Return has_vowels & long_enough & good_start. > > words = ['Good',' Presentation', 'preschool',' prefix'] > > list (filter (good_word, words)) ['Presentation',' preschool'] these are all the contents of this article "how python uses Filter () filter function". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!