Files renamed to python-style

This commit is contained in:
2016-02-22 18:00:24 +03:00
parent 7c39389384
commit 3eb13ac8e6
3 changed files with 123 additions and 0 deletions

22
all-good-ids.py Normal file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import json
import os
from os.path import join
all_ids = {}
for dirpath, dirnames, filenames in os.walk(sys.argv[1]):
for f in filenames:
fp = os.path.join(dirpath, f)
for uid in open(fp):
uid = int(uid)
if uid in all_ids:
all_ids[uid] += 1
else:
all_ids[uid] = 1
f_out = open(sys.argv[2],'w')
f_out.write(json.dumps(all_ids))