Skip to content

Instantly share code, notes, and snippets.

@kunigami

kunigami/generator_pipe.py

Last active Jan 29, 2020
Embed
What would you like to do?
def get_words():
f = open('/usr/share/dict/words', 'r')
for line in f:
yield line.strip()
def filter_step(lines):
for line in lines:
if (line[-3:] == 'ion'):
yield line
def print_step(lines):
for w in filtered_words:
print(w)
words = get_words()
filtered_words = filter_step(words)
print_step(filtered_words)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.