Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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;")


share|improve this question
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. – Stephen Lead Dec 19 '14 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 – Tristan Forward Dec 19 '14 at 21:53
up vote 11 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

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.