Created
January 14, 2010 10:14
-
-
Save russelnickson/277035 to your computer and use it in GitHub Desktop.
Count Sentences
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from string import split | |
f=open(sys.argv[1]) | |
content=f.read() | |
print content | |
print 'the no.of sentences in file = '+ str(len(split(content,'.'))-1) | |
# we sub 1 is because split creates a null element after the last '.' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment