-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRowToApi.py
executable file
·38 lines (37 loc) · 928 Bytes
/
RowToApi.py
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
# ===================================
# This file is used to crate Array Of Objects of hiram per sem semester wise data
# ===================================
f1=open("./static/Nirma_Data.txt","r")
data=f1.read()
list1=data.split("End")
persem_list=list(map(lambda x: x.split("\n"),list1))
# print(persem_list)
Data_inDic={}
tem=1
last=-1
for i in persem_list:
i.remove("")
if "" in i:
i.remove("")
if(i[0][0:8]!="Semester"):
# print(i)
if tem !=1:
Data_inDic[last]=tem
last=i[0]
i.remove(i[0])
tem={}
tem[i[0]]=i[1:]
Data_inDic[last]=tem
for i in Data_inDic:
# print(i):
for sem in Data_inDic[i]:
# print(f'{sem} {i}')
list=Data_inDic[i][sem]
for i1 in range(len(list)):
list[i1]=list[i1].split("-")
import json
f1.close()
f1=open("tem1.py","w")
f1.write("DATA=")
f1.write(json.dumps(Data_inDic))
f1.close()