<?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 Dissolve - python looping in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/dissolve-python-looping/m-p/685282#M53065</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I started learning python coding recently. I have hundreds of shape files in a geodatabase. i am dissolving certain fields in each shapefile. For this i am writing a for loop so that it reads each shape file in the geodatabse, dissolves the identical fields and save them in a new geodatabase as a separate file. Can anyone help me to write the code so that each file is saved with different name. Here is the code i came up with.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# import system modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import os&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set environment settings&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;env.workspace = "C:/Users/raghuravi23/Desktop/New folder/test2.gdb"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set local variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fcList = arcpy.ListFeatureClasses()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for fc in fcList:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Dissolve_management(fc, "C:/Users/raghuravi23/Desktop/New folder/Blocks.gdb", ["STATEFP10", "COUNTYFP10", "TRACTCE10", "BLKGRPCE10", "BLOCKCE10"],"[[Shape_Length,{sum},Shape_Area,{SUM}]]", "", "DISSOLVE_LINES") &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Jun 2014 19:17:49 GMT</pubDate>
    <dc:creator>Naga_RaghuveerModala</dc:creator>
    <dc:date>2014-06-25T19:17:49Z</dc:date>
    <item>
      <title>Dissolve - python looping</title>
      <link>https://community.esri.com/t5/python-questions/dissolve-python-looping/m-p/685282#M53065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I started learning python coding recently. I have hundreds of shape files in a geodatabase. i am dissolving certain fields in each shapefile. For this i am writing a for loop so that it reads each shape file in the geodatabse, dissolves the identical fields and save them in a new geodatabase as a separate file. Can anyone help me to write the code so that each file is saved with different name. Here is the code i came up with.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# import system modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import os&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set environment settings&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;env.workspace = "C:/Users/raghuravi23/Desktop/New folder/test2.gdb"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set local variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fcList = arcpy.ListFeatureClasses()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for fc in fcList:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Dissolve_management(fc, "C:/Users/raghuravi23/Desktop/New folder/Blocks.gdb", ["STATEFP10", "COUNTYFP10", "TRACTCE10", "BLKGRPCE10", "BLOCKCE10"],"[[Shape_Length,{sum},Shape_Area,{SUM}]]", "", "DISSOLVE_LINES") &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jun 2014 19:17:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/dissolve-python-looping/m-p/685282#M53065</guid>
      <dc:creator>Naga_RaghuveerModala</dc:creator>
      <dc:date>2014-06-25T19:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Dissolve - python looping</title>
      <link>https://community.esri.com/t5/python-questions/dissolve-python-looping/m-p/685283#M53066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Naga,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could add a variable at the end of the feature class name that increments for each feature class.&amp;nbsp; Ex:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
x = 1

for fc in fcList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Dissolve_management(fc, "C:/Users/raghuravi23/Desktop/New folder/Blocks.gdb/fc_" + str(x), ["STATEFP10", "COUNTYFP10", "TRACTCE10", "BLKGRPCE10", "BLOCKCE10"],"[[Shape_Length,{sum},Shape_Area,{SUM}]]", "", "DISSOLVE_LINES")
&amp;nbsp;&amp;nbsp;&amp;nbsp; x += 1&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:49:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/dissolve-python-looping/m-p/685283#M53066</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-12T04:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dissolve - python looping</title>
      <link>https://community.esri.com/t5/python-questions/dissolve-python-looping/m-p/685284#M53067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Jake, Got it working&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jun 2014 20:07:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/dissolve-python-looping/m-p/685284#M53067</guid>
      <dc:creator>Naga_RaghuveerModala</dc:creator>
      <dc:date>2014-06-25T20:07:12Z</dc:date>
    </item>
  </channel>
</rss>

