You have one level of quote too much. If your variable is already a string, no need to add extra "" to tell that it is a string. Think of what you want to write if you run a selection in ArcMap. In this case: Att = 'Red' while your where_clause gives: "Att = 'Red'" In your case, you should use this where clause: where_clause = "Att = '{}'".format(val) or where_clause = "Att = '" + val + "'"