-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdate.py
More file actions
34 lines (24 loc) · 792 Bytes
/
date.py
File metadata and controls
34 lines (24 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import json
date=[]
datefin=[]
with open('par25.json') as json_data2:
data_dict2 = json.load(json_data2)
for e in data_dict2:
date.append(e["DatePublication"])
date = list(set(date))
for e in cand:
candfin.append([e,0])
with open('par25.json') as json_data2:
data_dict2 = json.load(json_data2)
for e in data_dict2:
for a in candfin:
if(a[0][8]+a[0][9]==(e["DatePublication"][8] + e["DatePublication"][9])):
a[1]+=1
sorted(candfin)
for i in candfin:
print(str(i[0])+ " : " + str(i[1]))
data=dict(candfin)
data ={k: v for k, v in sorted(data.items(), key=lambda item: item[1], reverse=True)}
print(data)
with open("particule.json", "w") as file:
json.dump(data, file, ensure_ascii=False)