instead of whereClause = ('"' + crimeField + '" <=' + "'" + crimefieldindex + "'") try myfield1 = arcpy.AddFieldDelimiters(lyr,crimeField) whereClause = '{0} <= '{1}''.format(myfield1,crimefieldindex)
import arcpy from arcpy import env env.overwriteOutput = 1 env.workspace = r"C:\Temp\Python\Test.gdb" citiesL = "citiesL" crimeField = "CRIME_INDE" crimefieldindex = "0.02" whereClause = '"' + crimeField + '" <=' + "'" + crimefieldindex + "'" universityField = "UNIVERSITY" universityfieldindex = "1" whereClause2 = '"' + universityField + '" =' + "'" + universityfieldindex + "'" arcpy.MakeFeatureLayer_management("Cities", citiesL) arcpy.SelectLayerByAttribute_management(citiesL, "NEW_SELECTION", whereClause + "AND" + whereClause2) arcpy.CopyFeatures_management(citiesL, "Cities2")
whereClause = '"' + crimeField + '" <=' + "'" + crimefieldindex + "'" whereClause2 = '"' + universityField + '" =' + "'" + universityfieldindex + "'"
arcpy.SelectLayerByAttribute_management(citiesL, "NEW_SELECTION", whereClause + "AND" + whereClause2)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.