AnsweredAssumed Answered

syntax error to select a row and then delete it

Question asked by helenak on May 2, 2012
Latest reply on May 9, 2012 by helenak

system: ArcGIS 9.3

1. In a point shapefile, I want to select a row named "R" in the field of "CXXXX." (such as C0987, C5639, and C8720)
2. Then the selected row wants to be deleted.

I ran the code below but found a syntax error "keyword cannot be an expression"
( GP.SelectLayerbyAttribute(fc, "NEW_SELECTION","C*"="R")

I do not understand what keyword here mean.
Please kindly help and thanks.

Python Code
##Script Name: Delete rows ##Description: delete selected rows ##Created By: Elaine Kuo ##Date: 03/05/2012   #Import standard library modules import win32com.client, sys, os  #Create the Geoprocessor object GP = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")    #Set the input workspace #GP.workspace = sys.argv[1] #Set the workspace. GP.Workspace= "G:/temp_stage_3_1_centroid_of_B_NB/test"  #Set the output workspace #outWorkspace = sys.argv[2] #Set the workspace. List all of the feature classes in the dataset outWorkspace= "G:/temp_stage_3_1_centroid_of_B_NB"   try:     #Get a list of the featureclasses in the input folder     fcs = GP.ListFeatureClasses()      # Loop through the above list     fcs.reset     fc =       while fc:          #Validate the new feature class name for the output workspace.         outFeatureClass = outWorkspace + os.sep +GP.ValidateTableName(fc,outWorkspace)                  # Get centroids of the feature classes          GP.Toolbox = "Data Management"         GP.SelectLayerbyAttribute(fc, "NEW_SELECTION","C*"="R")         GP.DeleteRows(fc)         fc =                  except:     GP.AddMessage(GP.GetMessages(2))     print GP.GetMessages(2)