diff --git a/count_word.py b/count_word.py index e69de29..ee4724f 100644 --- a/count_word.py +++ b/count_word.py @@ -0,0 +1,13 @@ +def countWord(filepath, word): + f = open(filepath,'r') + para = f.read() + words = para.split() + c = 0 + for i in words: + if i == word: + c += 1 + return c + +path = "./files/testfile.txt" +word = "Lorem" +countWord(path,word) diff --git a/count_word.pyc b/count_word.pyc new file mode 100644 index 0000000..45e30d9 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..6f38991 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..4f02f95 Binary files /dev/null and b/tests/test_countWord.pyc differ