Skip to content

Instantly share code, notes, and snippets.

@russelnickson
Created January 14, 2010 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save russelnickson/277035 to your computer and use it in GitHub Desktop.
Save russelnickson/277035 to your computer and use it in GitHub Desktop.
Count Sentences
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