skip to Main Content

Convert the text input file to JSON in Python

I am using python to convert the text input file to json. My Code: import json import re filename = "text.txt" text = {} pattern = re.compile(r's*([^=t]+)s*=s*(.*)') with open(filename, encoding='utf8') as file: for line in file: match = pattern.match(line.strip()) if…

VIEW QUESTION
Back To Top
Search