Var = "Jonathan"
new_data = {"premium": Var}
json_object['classes'][states].update(new_data)
This was the code I used, the error I got was this: TypeError: bad operand type for unary : 'str'
How can I work around this? In the actual code the string is not Jonathan, it is something that is created by the code.
CodePudding user response:
It should be:
Var = "Jonathan"
new_data = {"premium": Var}
just remove
sign