Finally rewrote the code for Python3!

This commit is contained in:
Crista Lopes
2018-12-13 19:57:17 -08:00
parent 4449f0b7ba
commit ed8c3cabaa
47 changed files with 70 additions and 115 deletions

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python
from __future__ import print_function
import sys, re, operator, string
#
@@ -88,7 +87,7 @@ class WordFrequencyCounter:
self._word_freqs[word] = 1
def __print_freqs(self):
word_freqs = sorted(self._word_freqs.iteritems(), key=operator.itemgetter(1), reverse=True)
word_freqs = sorted(self._word_freqs.items(), key=operator.itemgetter(1), reverse=True)
for (w, c) in word_freqs[0:25]:
print(w, ' - ', c)