0

I am trying to write a python code for select analysis.

FIPS: column in feature nameofinputfeature whose values needs to be compared with OFIPS

OFIPS: variable whose value is known each time the code is run.

I am having a problem in syntax of the {where clause}

my code is:

arcpy.Select_analysis("nameofinputfeature", "C:\\a.shp", '"FIPS" = %OFIPS%')
PolyGeo
  • 65,136
  • 29
  • 109
  • 338
pnkjmndhl
  • 794
  • 1
  • 9
  • 20
  • 1
    It looks like you're mixing modelbuilder (%OFIPS%) and arcpy. Are you saying your OFIPS is a variable that value comes from somewhere in say a loop? So it'll run multiple times and OFIPS value changes each time its run? – KHibma Apr 26 '17 at 13:34
  • Yes, the value of OFIPS changes each time the loop is run, but I cant make it run even with a variable whose value is known (with no loop) – pnkjmndhl Apr 26 '17 at 13:45
  • 3
    There are a lot of answers already in the previously mentioned gis.se post. However, simply change '"FIPS" = %OFIPS%' to '"FIPS" = {}'.format(OFIPS) (assuming OFIPS is a variable in your code) – KHibma Apr 26 '17 at 13:50

0 Answers0