cur.execute("DELETE FROM %s WHERE id = %s", (table, id))
трябва да бъде
cur.execute("DELETE FROM %s WHERE id = %s" % (table, id))
cur.execute("DELETE FROM %s WHERE id = %s", (table, id))
трябва да бъде
cur.execute("DELETE FROM %s WHERE id = %s" % (table, id))