Answer the question
In order to leave comments, you need to log in
How to write and read list from mysql database?
I decided to ban some commands for the bot. According to the plan, the owner will use a command (for example /deactivate <command>
), after which the bot pulls out a list from the database, writes the disabled command there and then sends the list back to the database. I don’t quite understand how to read the sheet normally, the output will be a string in the form["help", "info", ...]
Answer the question
In order to leave comments, you need to log in
import ast
data = '["help", "info"]'
result = ast.literal_eval(data)
print(type(result), result)
import json
data = '["help", "info"]'
result = json.loads(data)
print(type(result), result)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question