diff --git a/count_word.py b/count_word.py index e69de29..ce76048 100644 --- a/count_word.py +++ b/count_word.py @@ -0,0 +1,9 @@ +import re +def countWord(file,string): + f = open(file,'r') + if not f: + return False + match = re.findall(string,f.read()) + #print match + return len(match) +print countWord('files/testfile.txt','Lorem') diff --git a/count_word.pyc b/count_word.pyc new file mode 100644 index 0000000..500bb9e 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..7e755e4 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..b2c72a8 Binary files /dev/null and b/tests/test_countWord.pyc differ