1
0
mirror of https://github.com/osmarks/random-stuff synced 2025-11-17 05:57:13 +00:00

declassify some projects

This commit is contained in:
2023-06-19 14:09:54 +01:00
parent 307c513a9b
commit 30a1e0e358
40 changed files with 2828 additions and 8 deletions

View File

@@ -0,0 +1,14 @@
import os, sys, string
count = 0
words = 0
characters = 0
for dirpath, dirnames, filenames in os.walk(sys.argv[1]):
for filename in filenames:
with open(os.path.join(dirpath, filename)) as f:
content = f.read()
characters += len([c for c in content if c in string.ascii_letters])
words += len([thing for thing in content.split() if thing.strip()])
count += 1
print(words / count, characters / count)