Skip to content

Instantly share code, notes, and snippets.

@edsu
Created August 19, 2011 02:51
Show Gist options
  • Select an option

  • Save edsu/1155921 to your computer and use it in GitHub Desktop.

Select an option

Save edsu/1155921 to your computer and use it in GitHub Desktop.
a generator example
def words(filename):
for line in open(filename):
words = line.split(' ')
for word in words:
yield word
for word in words('file.txt'):
print word
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment