jhchan69

selecting from a FGDB where the item has apostrophes

Discussion created by jhchan69 on Feb 10, 2012
Latest reply on Feb 10, 2012 by jhchan69
I am trying to perform a SearchCursor or alternatively a SelectLayerByAttribute where the data will sometimes contain special characters, like apostrophes, dashes, and slashes.

I'm trying to figure out how to make the apostrophes work in my query.
eg.
featureclass = r"C:\my feature class"
qry = "Item_Name = 'John's Cabin' "
arcpy.SearchCursor(featureclass, qry)

that of course doesn't work. But I've tried a few different things, and none works.
I've tried:
qry = "John\'s Cabin"; John''s Cabin and neither work. Any other suggestions?

Outcomes