0
Is there any way I can introduce variable for the command of mysql example.execute("create database #var")in python?
1.import mysql. connector 2.mydb=mysql.connector 3.example=mydb.cursor() 4.example. execute("create database #var")
1 Answer
+ 1
It's just a string and thus any string formatting technique will work.
E.g.
example.execute("create database {}".format(var))