diff --git a/count_word.py b/count_word.py index e69de29..4f1e972 100644 --- a/count_word.py +++ b/count_word.py @@ -0,0 +1,14 @@ +def countWord(filepath,word): + file1=open(filepath,"r") + count = 0 + line=file1.readline() + while (line != ""): + words = line.split() + for i in words: + if i == word: + count += 1 + line=file1.readline() + + + file1.close() + return count diff --git a/count_word.pyc b/count_word.pyc new file mode 100644 index 0000000..d12d40c Binary files /dev/null and b/count_word.pyc differ diff --git a/tests/__init__.pyc b/tests/__init__.pyc new file mode 100644 index 0000000..66ca3a9 Binary files /dev/null and b/tests/__init__.pyc differ diff --git a/tests/test_countWord.pyc b/tests/test_countWord.pyc new file mode 100644 index 0000000..015be50 Binary files /dev/null and b/tests/test_countWord.pyc differ