skip to Main Content

How to Convert cobal statement to Json

i have to convert cobal statement to json import re import json def extract_cursor(cobol_statement): pattern = r"MODIFY MAP (?: CURSOR|TEMP|FOR|PERM|CURSOR)?(?:CURSOR)?(?: AT)?(?: FIELD)?(?: DFLD)?s+([w-]+)(?!()" action_regex = re.compile(pattern, re.IGNORECASE) action_match = action_regex.search(cobol_statement) if action_match: cursor_value = action_match.group(1) if cursor_value.upper() != "FIELD" and…

VIEW QUESTION

How to remove json elements and reformat it

I have the follow JSON as an output of an enumerate function. {'question': (0, 'Who invented the light bulb?'), 'answers': [{'answer': 'Thomas Edison', 'score': '2.0'}, {'answer': 'Nikola Tesla', 'score': '2.0'}, {'answer': 'Albert Einstein', 'score': '0.0'}], 'error': "We didn't quite get…

VIEW QUESTION

How, in Python 3, can I have a client open a socket to a server, send 1 line of JSON-encoded data, read 1 line JSON-encoded data back, and continue?

I have the following code for a server listening on a port: def handle_oracle_query(self, sock, address): sockIn = sock.makefile('rb') sockOut = sock.makefile('wb') line = sockIn.readline() submitted_data = json.loads(line) self.get_thread_specific_storage()['environmental_variables'] = submitted_data['environmental_variables'] self.get_thread_specific_storage()['cgi'] = submitted_data['cgi'] generate_output() print_output(sockOut) sock.close() sockIn.close() sockOut.close() self.remove_thread_specific_storage()…

VIEW QUESTION
Back To Top
Search