diff --git a/count_word.py b/count_word.py index e69de29..bdd93b7 100644 --- a/count_word.py +++ b/count_word.py @@ -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) diff --git a/count_word.pyc b/count_word.pyc new file mode 100644 index 0000000..71d70ad 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..9a6ca95 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..7d1d252 Binary files /dev/null and b/tests/test_countWord.pyc differ