I'm trying to insert data into my database and I get a MYSQL syntax error using this code:
import MySQLdb
db=MySQLdb.connect(host="localhost",user="root",passwd="",db="database")
cursor = db.cursor()
sql = "INSERT INTO table1('col1','col2') values ('val1','val2');"
cursor.execute(sql)
db.commit()