Files
dragonpilot/scripts/count_cars.py

16 lines
528 B
Python
Raw Normal View History

2021-03-30 14:01:58 -07:00
#!/usr/bin/env python3
import os
2021-11-18 20:56:20 -08:00
from collections import Counter
from pprint import pprint
2021-03-30 14:01:58 -07:00
from common.basedir import BASEDIR
2021-09-15 11:31:45 -07:00
with open(os.path.join(BASEDIR, "docs/CARS.md")) as f:
2021-03-30 14:01:58 -07:00
lines = f.readlines()
cars = [l for l in lines if l.strip().startswith("|") and l.strip().endswith("|") and
"Make" not in l and any(c.isalpha() for c in l)]
2021-11-18 20:56:20 -08:00
make_count = Counter(l.split('|')[1].split('|')[0].strip() for l in cars)
2021-11-18 20:56:20 -08:00
print("\n", "*"*20, len(cars), "total", "*"*20, "\n")
pprint(make_count)