format_strings = ','.join(['%s'] * len(list_of_ids))
cursor.execute('DELETE FROM foo.bar WHERE baz IN (%s)' % format_strings,
    tuple(list_of_ids))
imploding a list for use in a python MySQLDB IN clause