<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using a search cursor for a list? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492919#M38645</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all.&amp;nbsp; Im a novice when it comes to python.&amp;nbsp; Im trying to use a search cursor to retrieve the specific value "drillhole" in the "Label" field of the attribute table for each feature class in a large directory.&amp;nbsp; Here is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy
arcpy.env.workspace = "X:"
ws = arcpy.ListWorkspaces("*","Folder")

for w in ws:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = w 
&amp;nbsp;&amp;nbsp;&amp;nbsp; gdb = arcpy.ListWorkspaces("*", "Access")
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in gdb:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = fc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcl = arcpy.ListDatasets("*", "Feature")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for fcc in fcl:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = fcc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fccl = arcpy.ListFeatureClasses("*", "All")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print fccl&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to use the search cursor on the list "fccl" in order to loop through all of these feature datasets and return the value "drillhole"?&amp;nbsp; Thanks for any help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Apr 2012 16:37:30 GMT</pubDate>
    <dc:creator>StevenWorkman</dc:creator>
    <dc:date>2012-04-30T16:37:30Z</dc:date>
    <item>
      <title>Using a search cursor for a list?</title>
      <link>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492919#M38645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all.&amp;nbsp; Im a novice when it comes to python.&amp;nbsp; Im trying to use a search cursor to retrieve the specific value "drillhole" in the "Label" field of the attribute table for each feature class in a large directory.&amp;nbsp; Here is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy
arcpy.env.workspace = "X:"
ws = arcpy.ListWorkspaces("*","Folder")

for w in ws:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = w 
&amp;nbsp;&amp;nbsp;&amp;nbsp; gdb = arcpy.ListWorkspaces("*", "Access")
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in gdb:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = fc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcl = arcpy.ListDatasets("*", "Feature")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for fcc in fcl:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = fcc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fccl = arcpy.ListFeatureClasses("*", "All")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print fccl&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to use the search cursor on the list "fccl" in order to loop through all of these feature datasets and return the value "drillhole"?&amp;nbsp; Thanks for any help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2012 16:37:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492919#M38645</guid>
      <dc:creator>StevenWorkman</dc:creator>
      <dc:date>2012-04-30T16:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using a search cursor for a list?</title>
      <link>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492920#M38646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Certainly!&amp;nbsp; You would need to go one for loop further.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for item in fccl: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then from there you would create the cursor, nest in a while loop, and then do what you need to do.&amp;nbsp; Just be sure to delete the cursor at the end of the loop, that way it creates it and destroys it all within the loop and nothing escapes once its done.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2012 16:52:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492920#M38646</guid>
      <dc:creator>RyanForbes1</dc:creator>
      <dc:date>2012-04-30T16:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using a search cursor for a list?</title>
      <link>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492921#M38647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not quite sure what you are asking. What about the attribute 'drillhole' in the 'Label' field do you want to know? The OID? Number of occurrences? Here's an example of identifying the row and then you can do what you want from there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;field = "Label"
value = "drillhole"
for fc in fccl:
&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s_curs = arcpy.SearchCursor(fc,"%s = '%s'" % (field,value),"","Label")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in s_curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # do something as each row should be a drillhole&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:41:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492921#M38647</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T21:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using a search cursor for a list?</title>
      <link>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492922#M38648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Untested, but I think it should work. You'll have to change your workspace environment to point at the individual feature class, also.&lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;...continue indentation from previous part of script...
&amp;nbsp;&amp;nbsp;&amp;nbsp; fccl = arcpy.ListFeatureClasses("*", "All")
&amp;nbsp;&amp;nbsp;&amp;nbsp; for featureclass in fccl:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.SearchCursor(featureclass)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; drillhole = row.Label&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:41:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492922#M38648</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-11T21:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using a search cursor for a list?</title>
      <link>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492923#M38649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Not quite sure what you are asking. What about the attribute 'drillhole' in the 'Label' field do you want to know? The OID? Number of occurrences? Here's an example of identifying the row and then you can do what you want from there.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;field = "Label"
value = "drillhole"
for fc in fccl:
&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s_curs = arcpy.SearchCursor(fc,"%s = '%s'" % (field,value),"","Label")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in s_curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # do something as each row should be a drillhole&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for you help Mathew. I am trying to find out which feature classes in a directory with 200+ folders has drillholes.&amp;nbsp;&amp;nbsp; I tried the code you gave me but this was what was returned:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;General function failure [ballinp_1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Too few parameters. Expected 1.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:41:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492923#M38649</guid>
      <dc:creator>StevenWorkman</dc:creator>
      <dc:date>2021-12-11T21:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using a search cursor for a list?</title>
      <link>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492924#M38650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks for you help Mathew. I am trying to find out which feature classes in a directory with 200+ folders has drillholes.&amp;nbsp;&amp;nbsp; I tried the code you gave me but this was what was returned:&lt;BR /&gt;&lt;BR /&gt;General function failure [ballinp_1]&lt;BR /&gt;Too few parameters. Expected 1.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That would probably be because there was no except statement added at the end. A simpler way to go about it might be to make a temp feature layer from each fc and do a select by attribute to see if get count returns anything.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2012 18:31:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492924#M38650</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-04-30T18:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: Using a search cursor for a list?</title>
      <link>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492925#M38651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; That would probably be because there was no except statement added at the end. A simpler way to go about it might be to make a temp feature layer from each fc and do a select by attribute to see if get count returns anything.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok. Ill try that method. You are saying that I need use MakeFeatureLayer_management (in_features, out_layer, where_clause, workspace, field_info) and make my in_features the list of layers (fccl). Does that need to be nested inside the loop? If you could, can you help me out with the code for that? Im a recent grad and am really new to this stuff. Thanks for any help. Heres what I have so far, but it isnt working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for w in ws:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = w 
&amp;nbsp;&amp;nbsp;&amp;nbsp; gdb = arcpy.ListWorkspaces("*", "Access")
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in gdb:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = fc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcl = arcpy.ListDatasets("*", "Feature")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for fcc in fcl:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = fcc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fccl = arcpy.ListFeatureClasses("*", "All")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for stil in fccl:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = fccl
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; stil = arcpy.SaveToLayerFile_management("fccl","fccl2","")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;Traceback (most recent call last):&lt;BR /&gt; File "C:\Python26\ArcGIS10.0\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 322, in RunScript&lt;BR /&gt; debugger.run(codeObject, __main__.__dict__, start_stepping=0)&lt;BR /&gt; File "C:\Python26\ArcGIS10.0\Lib\site-packages\Pythonwin\pywin\debugger\__init__.py", line 60, in run&lt;BR /&gt; _GetCurrentDebugger().run(cmd, globals,locals, start_stepping)&lt;BR /&gt; File "C:\Python26\ArcGIS10.0\Lib\site-packages\Pythonwin\pywin\debugger\debugger.py", line 655, in run&lt;BR /&gt; exec cmd in globals, locals&lt;BR /&gt; File "C:\Documents and Settings\WorkmanS\Desktop\Script5.py", line 16, in &amp;lt;module&amp;gt;&lt;BR /&gt; arcpy.env.workspace = fccl&lt;BR /&gt; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py", line 505, in set_&lt;BR /&gt; self[env] = val&lt;BR /&gt; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py", line 557, in __setitem__&lt;BR /&gt; ret_ = setattr(self._gp, item, value)&lt;BR /&gt;RuntimeError: &amp;lt;unprintable RuntimeError object&amp;gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:41:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492925#M38651</guid>
      <dc:creator>StevenWorkman</dc:creator>
      <dc:date>2021-12-11T21:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using a search cursor for a list?</title>
      <link>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492926#M38652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Close. You can't make a feature class a workspace though. And you just want a temp layer for selection not a permanent layer file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try something like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
arcpy.env.overwriteOutput = True
tempLayer = r"in_memory\templayer"
field = "Label"
value = "drillhole"
where = "%s = '%s'" % (field,value)
dhList = []
for w in ws:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = w
&amp;nbsp;&amp;nbsp;&amp;nbsp; gdb = arcpy.ListWorkspaces("*", "Access")
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in gdb:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = fc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcl = arcpy.ListDatasets("*", "Feature")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for fcc in fcl:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = fcc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fccl = arcpy.ListFeatureClasses("*", "All")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for stil in fccl:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(stil, tempLayer, where)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(tempLayer)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count = int(arcpy.GetCount_management(tempLayer).getOutput)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if count &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dhList.append(stil)
for item in dhList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print item&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:41:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492926#M38652</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T21:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using a search cursor for a list?</title>
      <link>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492927#M38653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I made a few adjustments to the script and it runs without getting any errors. I highlighted the changes in red:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
arcpy.env.workspace = "X:"
ws = arcpy.ListWorkspaces("*","Folder")
arcpy.env.overwriteOutput = True
tempLayer = r"in_memory\templayer"
field = "Label"
value = "drillholes"
where = "%s = '%s'" % (field,value)
dhList = []
for w in ws:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = w
&amp;nbsp;&amp;nbsp;&amp;nbsp; gdb = arcpy.ListWorkspaces("*", "Access")
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in gdb:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = fc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcl = arcpy.ListDatasets("*", "Feature")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for fcc in fcl:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = fcc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fccl = arcpy.ListFeatureClasses("*", "All")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for stil in fccl:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(stil, tempLayer, where)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(tempLayer,"SUBSET_SELECTION")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count = str(arcpy.GetCount_management(tempLayer).getOutput)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if count &amp;gt; 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dhList.append(stil)
for item in dhList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print item
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The only problem now is the output is showing all of the feature classes in my directory instead only the feature classes that contain drillholes.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:32:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-a-search-cursor-for-a-list/m-p/492927#M38653</guid>
      <dc:creator>StevenWorkman</dc:creator>
      <dc:date>2021-12-12T16:32:19Z</dc:date>
    </item>
  </channel>
</rss>

