So far my code is this :
from glob import glob
shakedir='D:\report\shakeall'
from shakedir import isfile
def countwords(fp):
with open(fp) as fh:
return len(fh.read().split())
print "There are" ,sum(map(countwords, filter(isfile, glob("*.txt") ) ) ), "words in the files."
The problem is this code doesn't work :)
I'm not used to Python grammar, so I just tried anything.
What I want is, I want this script to import text files from specific directory.
Not from the os.path, where my .py file is.
I want to import from D:\report\shakeall and I can't. That's it.
Thanks for any advice.