Skip to content

Commit b2124df

Browse files
committed
word counter
1 parent 1d2ff87 commit b2124df

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

PyBeaner/0004/wc.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from collections import Counter
2+
import re
3+
4+
__author__ = "PyBeaner"
5+
6+
with open(r"F:\Program Files\Git\doc\git\html\RelNotes\1.5.0.1.txt") as f:
7+
word_pat = re.compile("^[A-Za-z]+$")
8+
file_words = [word for line in f for word in line.split()
9+
if len(word) > 1 and word_pat.match(word)]
10+
11+
print(Counter(file_words))

0 commit comments

Comments
 (0)