Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import string
- file_name=sys.argv[0]
- char= words = lines = theCount = aCount= 0
- with open(file_name,'r') as in_file:
- for line in in_file:
- lines +=1
- words +=len(line.split())
- char +=len(line)
- if 'the' in words:
- theCount +=1
- if 'a' in words:
- a +=1
- if 'an' in words:
- a +=1
- print("Filename:", file_name)
- print("Number of lines:", lines)
- print("Number of characters:", char)
- print("Number of 'the'", theCount)
- print("Number of a/an:", aCount)
Add Comment
Please, Sign In to add comment