AnsweredAssumed Answered

String formatting ? for definition query

Question asked by recurvata on Apr 10, 2012
Latest reply on Apr 10, 2012 by recurvata
I'm trying to set up a definition query for a layer, but can't get the formatting correct. I've tried several variations of the code below w/o success, such as writing the query out in triple double quotes (which for some reason required an extra double quote) . Appreciate any help. This kind of thing was easier in the old days of VB & VBA.
    case_number = arcpy.GetParameterAsText(0)     fld = "Case_"                                                            # tried substituting this for "Case_" in the line below, for example.     query = '"%s"' + " = " + "'%s'" % ("Case_", case_number)  #1st %s is single, double, double single quotes; 2nd is double single single double      # query should look like "Case_" = 'A-BC-12-34' where case_number = A-BC-12-34,

<type 'exceptions.TypeError'>: not all arguments converted during string formatting