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")

25th Nov 2019, 1:26 PM
Urmi
Urmi - avatar
1 Odpowiedź
+ 1
It's just a string and thus any string formatting technique will work. E.g. example.execute("create database {}".format(var))
25th Nov 2019, 3:00 PM
Шащи Ранжан
Шащи Ранжан - avatar