November 2015
Intermediate to advanced
304 pages
5h 23m
English
Chapter 27

1 #!/usr/bin/env python 2 import sys, operator, string 3 4 def characters(filename): 5 for line in open(filename): 6 for c in line: 7 yield c 8 9 def all_words(filename): 10 start_char = True 11 for c in characters(filename): 12 if start_char == True: 13 word = "" 14 if c.isalnum(): 15 # We found the start of a word 16 word = c.lower() 17 start_char = False 18 else: pass ...