WAslayer
Honorary Master
Straight off the bat, I have no Dev background (unless you count bash scripting) and like started yesterday new to python and stuck on something:
Given two variables:
one = ABC
two = '{ "A": "B" }'
I need to replace B in variable two with the variable one:
two = '{"A": "one" }'
So that the end result is:
'{"A": "ABC" }'
Without altering the syntax/format of variable two, as that becomes a body for a POST request and the API is expecting that JSON body..
I have tried:
two = '{"A": " {} " }'.format(one)
And something similar as above, just using f strings as well something with a percentage symbol.. none worked and I am guessing it's because the value is encapsulated in single quotes..
Given two variables:
one = ABC
two = '{ "A": "B" }'
I need to replace B in variable two with the variable one:
two = '{"A": "one" }'
So that the end result is:
'{"A": "ABC" }'
Without altering the syntax/format of variable two, as that becomes a body for a POST request and the API is expecting that JSON body..
I have tried:
two = '{"A": " {} " }'.format(one)
And something similar as above, just using f strings as well something with a percentage symbol.. none worked and I am guessing it's because the value is encapsulated in single quotes..