Reputation: 33
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.
Upvotes: 1
Views: 44
Reputation: 27910
It should be:
Var = "Jonathan"
new_data = {"premium": Var}
just remove +
sign
Upvotes: 1