Unformatted text preview: # so simply count these characters sentences += line.count('.') + line.count('!') + line.count('?') # create a list of words # use None to split at any whitespace regardless of length # so for instance double space counts as one space tempwords = line.split(None) print tempwords # test # word total count words += len(tempwords) textf.close() print '-' * 50 print "Lines : ", lines print "Blank lines: ", blanklines print "Sentences : ", sentences print "Words : ", words...
View Full Document
- Fall '08
- Computer file formats, print print print, filename import sys