I would like to Clear Any Selected Features using python since it causes an error if I run my tool and the user has a recorded selected.

I need some thing here that runs ("CLEAR_SELECTION") first

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


  • 1
    I reverted your edit - it doesn't make sense to edit the question to show the answer. The correct approach is to leave your question as originally asked, and have the answer shown below. Dec 19, 2014 at 2:56
  • I think I had done it this way since it does not let you answer your own question right away. Anyways will note for future posts Dec 19, 2014 at 21:53

1 Answer 1


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!

  • and how do I clear ALL selections? May 28, 2019 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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