Functional Programming Tools: filter : filter : Buildin Function : Python examples (example source code) Organized by topic

C++
PHP
Python


Python  »  Buildin Function   » [  filter  ]  Screenshots 
 



Functional Programming Tools: filter



"filter(function, sequence)" returns a sequence consisting of those items from 
# the sequence for which function(itemis trueIf sequence is a string or tuple, 
# the result will be of the same type; otherwise, it is always a list. 
# For example, to compute some primes:

def f(x)return x % != and x % != 0

print filter(f, range(225))

           
       
Related examples in the same category
1.  Filter demo: lambda function inside Filter demo: lambda function inside
2.  Compute prime numbers in Python Compute prime numbers in Python
3.  filer with lambda function and range filer with lambda function and range
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.