I am trying to write a script where the user can search for a five digit zipcode using an input statement and a search cursor. The zipcodes in the file though are nine characters long (i.e. xxxxx-xxxx) so I'm trying to use the wildcard character after five digits in the where clause but I can't figure out either where to put it or the syntax I'm supposed to use. Currently I can get the use input zipcode to print out but when I try putting the % wildcard in I get an error. Can anyone help me?
Here is my code so far:
import arcpy
#set workspacework=raw_input("work= ")arcpy.env.workspace=workzip5=input("zip5= ")strZip= str(zip5)
def searchHospitals(work,zip5): fc= "Hospital.shp" whereClause= '"ZIPCODE" LIKE'+"'%s'"% strZip print whereClause
أكثر...
Here is my code so far:
import arcpy
#set workspacework=raw_input("work= ")arcpy.env.workspace=workzip5=input("zip5= ")strZip= str(zip5)
def searchHospitals(work,zip5): fc= "Hospital.shp" whereClause= '"ZIPCODE" LIKE'+"'%s'"% strZip print whereClause
أكثر...