Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Clear Any Selected Features using python to prevent error if user has a recorded selected before running the tool.


rows = arcpy.SearchCursor(Table, " \"Name\" LIKE 'Albert%' ", "", "Name;")

Edited to show answer.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Here is the help document covering the function in question: Select Layer by Attribute (Data Management)

I think this is how you would implement it:

arcpy.SelectLayerByAttribute_management(Table, "CLEAR_SELECTION")
rows = arcpy.SearchCursor(Table, " \"Name\" LIKE 'Albert%' ", "", "Name;")

As an aside, there are a lot of helpful examples of how to use the various toolbox tools, and their python implementations on the ArcGIS Desktop Help Site in the Professional Library. Oftentimes a quick search there will yield an answer faster than on GIS.se

Hope this helps!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.