I'm trying to put a variable into a string used to do a selection. At the moment it's like this...
expression = "'No_Props' > 5 AND %s < 200 AND 'ST_Ori' >60" % metres_field arcpy.SelectLayerByAttribute_management(streets_table, "NEW_SELECTION", '"' + expression + '"')
Printing the expression gives this....
'No_Props' > 5 AND 'Shape_Le_2' < 200 AND 'ST_Ori' >60
.. which I thought would work.
I've tried several things. Originally the expression was in a docstring..
"""'No_Props' > 5 AND %s < 200 AND 'ST_Ori' >60""" % metres_field
.. but that didn't work
I considered using the doc attribute but it only worked on a function (not a variable)
Anyone know what I'm doing wrong / how to make it work? The expression looks like it should do the trick when it's printed out..
Anyone have any ideas?