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 Answer
+ 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