I am trying to select by an attribute with a condition that field equals to an element of a vector. I use a for loop but could not get the right expression for this condition. Here are my codes.
random37 = [30449, 46617, 17309]
pointlayer = "network_nodeSelected"
for random in random37:
randomname = "n" + str(random)
arcpy.MakeFeatureLayer_management(pointlayer,pointlayer)
arcpy.SelectLayerByAttribute_management(pointlayer,'NEW_SELECTION','"ARC_" = random')
arcpy.CopyFeatures_management(pointlayer, randomname)
print randomname
The error message is presented as follows.
Traceback (most recent call last):
File "", line 6, in arcpy.SelectLayerByAttribute_management(pointlayer,'NEW_SELECTION','"ARC_" = point')
File "C:\Program Files (x86)\ArcGIS\Desktop10.6\ArcPy\arcpy\management.py", line 7742, in SelectLayerByAttribute raise e
ExecuteError: ERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute).
As you can see, my problem is the expression '"ARC_" = random'. But I do not know how to get the right expression.