-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse.py
More file actions
42 lines (18 loc) · 702 Bytes
/
parse.py
File metadata and controls
42 lines (18 loc) · 702 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
33
34
35
36
37
38
39
40
41
import json
with open('data.txt','r') as file:
data = file.read()
data1 = json.loads(data)
core_tempt = [] #this array will store dictionary
temp_input = [] #this array will store tempreture values
for data in data1['coretemp-isa-0000']:
new_Data=data1['coretemp-isa-0000'][data]
core_tempt.append(new_Data)
for i in range(1,5):
val=core_tempt[i]['temp'+str(i)+'_input']
temp_input.append(int(val))
# write tempreture to same file by overwitting json data to temp values
with open('data.txt','w') as file: #to delete any existing value
pass
with open('data.txt','a') as file:
for val in temp_input:
file.write(str(val)+'\n')