Line of code:
data = '{"username": {u}, "password": {p}}'.format(u=user_name, p=password)
I just want to insert variables user_name and password inside the stringified dict above in the places u and p resp.
Error:
data = '{"username": {u}, "password": {p}}'.format(u=user_name, p=password)
KeyError: '"username"'
I also tried with:
data = f'\{"username": {user_name}, "password": {password}\}'
But that didn't seem to work.
Any other way to tackle this?
data = '{{"username": {u}, "password": {p}}}'.format(u=user_name, p=password)(see answer from @Masklinn)