Home > Net >  Transforming python variable into string
Transforming python variable into string

Time:04-07

I have a variable username = "jag", and jag is stored as a string.

Later on down the code, I need to use the username variable here like this: db[(username)] = 1

However, that line of code only excepts input like this db["jag"] = 1

How can I get around this issue by "pre-converting" the variable before use?

The package that I use is from from replit import db

CodePudding user response:

I do see now that db[username] = 1 works perfectly fine. I had a function hanging out that I did not see.

  • Related