value = '{"a" : 0, "b": 6, "c" : {REPLACE}}'
replace = {'REPLACE' : "Replace String"}
value.format(**replace)
value.format(replace)
is giving me error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: '"a"'
value = '{"a" : 0, "b": 6, "c" : {REPLACE}}'
replace = {'REPLACE' : "Replace String"}
value.format(**replace)
value.format(replace)
is giving me error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: '"a"'
Unfortunately {
braces are part of the formatting language to escape them you need to double them {{
, so:
In []:
value = '{{"a" : 0, "b": 6, "c" : {REPLACE}}}'
replace = {'REPLACE' : "Replace String"}
value.format(**replace)
Out[]:
'{"a" : 0, "b": 6, "c" : Replace String}'