Dec-20-2016, 08:19 AM
If i use no a variable but a value
('AAAA',)
import time import MySQLdb var = 'AAAA' db = MySQLdb.connect(host="localhost", user="root", passwd="", db="db") cursor = db.cursor() sql = "select valore from tab where valore LIKE '%AA%' " number_of_rows = cursor.execute(sql) print(cursor.fetchone()) db.close()result is ok
('AAAA',)