lc - lines = lines 1 for count in line.split lc[count =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#!/usr/bin/env python #counts lines import re target = 'midterm2.txt' doc = (file(target)) lines = 0 lc = {} for line in doc: line = re.sub('r[^a-z]',' ',line.lower())
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: lines = lines + 1 for count in line.split(): lc[count] = lc.get(count,0) + 1 print lines...
View Full Document

This note was uploaded on 09/06/2009 for the course LING 571 taught by Professor Staff during the Fall '08 term at San Diego State.

Ask a homework question - tutors are online