-
Notifications
You must be signed in to change notification settings - Fork 50
/
sclean.py
23 lines (22 loc) · 763 Bytes
/
sclean.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: UTF-8 -*-
import codecs
import sys
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
import os
import json
import io
import time
from copy import deepcopy
rootdir="/home/riko/S1PlainTextBackup/"
with open(rootdir+'RefreshingData.json',"r",encoding='utf-8') as f:
thdata=json.load(f)
newthdata = deepcopy(thdata)
for i in thdata.keys():
if thdata[i]['totalreply'] // 40 < 15 and not thdata[i]['active']:
if thdata[i]['newtitle'] == '[]':
# if thdata[i]['totalreply'] == 0:
# if thdata[i]['totalreply'] < 40:
newthdata.pop(i)
with open(rootdir+'RefreshingData.json',"w",encoding='utf-8') as f:
f.write(json.dumps(newthdata,indent=2,ensure_ascii=False))
print("finish")