Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- filename = "words.txt"
- numLines = 0
- numWords = 0
- numChars = 0
- with open(filename, 'r') as file:
- for line in file:
- wordsList = line.split()
- numLines += 1
- numWords += len(wordsList)
- numChars += len(line)
- print "Lines: %i/nWords: %i/nCharacters: %i" % (numLines, numWords, numChars)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement