Modernize Python 2 code to get ready for Python 3
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
import heapq, re, sys
|
||||
|
||||
words = re.findall("[a-z]{2,}", open(sys.argv[1]).read().lower())
|
||||
for w in heapq.nlargest(25, set(words) - set(open("../stop_words.txt").read().split(",")), words.count):
|
||||
print w, "-", words.count(w)
|
||||
print(w, "-", words.count(w))
|
||||
|
||||
Reference in New Issue
Block a user