使用正则表达式:
import redata = """{ Name: "test", Address: "xyz"}"""print( re.sub("(w+):", r'"1":', data) )输出:
{ "Name": "test", "Address": "xyz"}
使用正则表达式:
import redata = """{ Name: "test", Address: "xyz"}"""print( re.sub("(w+):", r'"1":', data) )输出:
{ "Name": "test", "Address": "xyz"}