Trying to figure out what the class_field variable is in this query
import arcpy
fc = 'c:/base/data.gdb/roads'
class_field = 'Road Class'
name_field = 'Name'
# Create an expression with proper delimiters
expression = arcpy.AddFieldDelimiters(fc, name_field) + ' = 2'
# Create a search cursor using an SQL expression
with arcpy.da.SearchCursor(fc, [class_field, name_field],
where_clause=expression) as cursor:
for row in cursor:
# Print the name of the residential road
print(row[1])
Solved! Go to Solution.
u denotes unicode... you don't do anything about it
I moved the correct answer to Mitch Holley who provided a link to the help, because I can. This very general question posed is well-answered by the Esri documentation in this case, and includes many useful examples.