Skip to content

Commit

Permalink
simplified wordcount counter
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenZcience committed Feb 17, 2024
1 parent 89d2a84 commit 5569cec
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions cat_win/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,7 @@ def _show_wordcount() -> None:
try:
with open(hfile.path, 'r', encoding=arg_parser.file_encoding) as file:
for token in re.findall(r'\w+|[^\s\w]', file.read()):
if token in word_count:
word_count[token] += 1
else:
word_count[token] = 1
word_count[token] = word_count.get(token, 0)+1
used_files.append(hfile.displayname)
except (OSError, UnicodeError):
pass
Expand Down

0 comments on commit 5569cec

Please sign in to comment.