Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions count_word.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import csv, itertools

file_path = "files/testfile.txt"
string = "Lorem"

def countWord(file_name,word):
cnt = 0
f = open(file_name)
for w in f.read().split():
if w==word:
cnt +=1
return cnt


print countWord(file_path, string)
Binary file added count_word.pyc
Binary file not shown.
Binary file added tests/__init__.pyc
Binary file not shown.
Binary file added tests/test_countWord.pyc
Binary file not shown.