AnsweredAssumed Answered

Where or Select clause

Question asked by jborgion Champion on Sep 10, 2018
Latest reply on Sep 11, 2018 by jborgion

Seems like I've had this problem before, but I can't find the solution searching in my past posts.

 

I need to step through a list of alpha site-ids,  and make a selection to a table view based on the given value of the list element.  Something like this:

 

my_list = ['BC_00.1', 'BC_00.2', 'BC_00.3']

for i in my_list:
  select = 'SITE_ID = {}'.format(i) ### <--- problem child
  arcpy.SelectLayerByAttribute_management(tableview,"NEW_SELECTION",select)

but my select variable is set up wrong in line 4 so I get barked at that line 5 has a syntax error.  It's question of where single and double quotes go in line 4, and for the life of me I just can't seem to get it.  (Could it be the last 10 days in the Mexican Riviera? Forgetting code snippets is the new Montezuma's Revenge. I once forgot my zip code after a trip to Mexico; that was great vacation...)

Outcomes