-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjsonGenerator.py
More file actions
28 lines (19 loc) · 838 Bytes
/
Copy pathjsonGenerator.py
File metadata and controls
28 lines (19 loc) · 838 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
#import os
import json
def Demo():
data = {}
data['ENV_FILE_DETAILS'] = []
file_open = open("/Users/sankar.biswas/Desktop/input_file.txt","r")
file_read = file_open.readlines()
heading = file_read[0].strip().split(":")[:-1]
length = len(heading)
dummy_data = {"MAX_SLA_WAIT_SECS_CNT":"300"}
for each_line in file_read[1:]:
values = each_line.strip().split("|")
for a in range(length):
dummy_data[heading[a].strip()[1:][:-1]] = values[a]
data['ENV_FILE_DETAILS'].append(dummy_data)
dummy_data = {"EVENT_NAME":"STM_MZ_PLI_LITE_COMPUTE","PROCESS_NAME":"STM_MZ_PLI_LITE","SLEEP_TIME":"60","MAX_SLA_WAIT_SECS_CNT":"300"}
with open('/Users/sankar.biswas/Desktop/data.json', 'w') as outfile:
json.dump(data, outfile)
Demo()