query = 'DELETE FROM table_name WHERE id IN ('
for i in range(10):
    query = query + "'" + str(i) + "', "
query = query[:-2] + ')'
cur = conn.cursor()
cur.execute(query)
MySQLdb с несколькими транзакциями на соединение