Finally rewrote the code for Python3!
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
import sys, re, operator, string, inspect
|
||||
|
||||
#
|
||||
@@ -42,7 +41,7 @@ def frequencies(word_list):
|
||||
|
||||
@AcceptTypes(dict)
|
||||
def sort(word_freq):
|
||||
return sorted(word_freq.iteritems(), key=operator.itemgetter(1), reverse=True)
|
||||
return sorted(word_freq.items(), key=operator.itemgetter(1), reverse=True)
|
||||
|
||||
word_freqs = sort(frequencies(extract_words(sys.argv[1])))
|
||||
for (w, c) in word_freqs[0:25]:
|
||||
|
||||
Reference in New Issue
Block a user