spark: add text_stats.py utility for counting lines/words/chars in text files

This commit is contained in:
spark committed 2026-10-24 13:37:32 +00:00
1 parent 397cae919d
commit 1c6f3ade0b
1 file changed
+1 -1
+1 -1
View File
@@ -10,7 +10,7 @@ def analyze_text(filepath):
try:
with open(filepath, 'r', encoding='utf-8', errors='replace') as f:
content = f.read()
lines = len(content.splitlines())
lines = content.count('\n')
words = len(content.split())
chars = len(content)
return lines, words, chars