print( "\t{0} words".format(wordcount), file=sys.stderr) if (ht.has(word)): ht.put(word, ht.get(word)+1) else: ht.put(word, 1) return len(words) - 1 i = 0 # with open('testtext.txt', 'r') as text: for filename in args.filenames: with open(filename, 'r') as text: for line in text: counter += process(line.strip()) #i += 1 #if i > 100: # break # else: # No more lines to be read from file # print(counter) # print() # print( "Counts:") for entry in ht.entries(): if (entry == None): pass else: print( "{0}\t{1}".format(entry.value(), entry.key())) print( "\t{0} words".format( ht.count()))