Created
March 6, 2019 02:42
-
-
Save sparkydogX/39021fbb7b77de540fd75af23eae3739 to your computer and use it in GitHub Desktop.
This is a simple example for python filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def evenFilter(d): | |
if d['idx'] % 2 == 0: | |
return True | |
else: | |
return False | |
if __name__ == '__main__': | |
L = [] | |
for i in range(10): | |
d={} | |
d['idx'] = i | |
L.append(d) | |
print(L) | |
fL = list(filter(evenFilter,L)) | |
print(fL) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment