we have huge number of files where we need to transfrom to json here is the sampple data of one file
{
1=2,
4=tt,
6=9
}
{
1=gg,
2=bd,
6=bb
}
I am using python to convert the data where regex expression is working fine but the same regex is not working when i implementing in python code here is the code
import numpy as np
f = open('/Users/rahulvarma/Downloads/2020120911.txt', 'r')
content = f.read()
import re
regex = r"([0-9]+)(=)((.*)+)"
subst = "\"$1\":\"$3\","
result = re.sub(regex, subst, content, 0, re.MULTILINE)
if result:
print (result)
but my were
{
"$1":"$3",
"$1":"$3",
"$1":"$3"
}
{
"$1":"$3",
"$1":"$3",
"$1":"$3"
}
my expected output should be
{
"1":"2",
"4":"tt",
"6":"9"
}
{
"1":"gg",
"2":"bd",
"6":"bb"
}
importis useless.