Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''count all keyword occurences'''
- import keyword
- def countKeyword(filename):
- count = 0
- f = open(filename, 'r')
- for key in keyword.kwlist:
- count = 0
- for line in f:
- if key in line:
- count = count + 1
- print(key + " count: " + str(count))
- f.seek(0)
- return count
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement