<?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 Re: HELP!!How to write the python script? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/help-how-to-write-the-python-script/m-p/424659#M33334</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan, TKS for the reply.&lt;/P&gt;&lt;P&gt;I am a Chinese student, and a beginner in python language. So, it is a little difficult in reading all the python scripts in your blog.Could u please point out which post is?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TKS a lot!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Zheng,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 May 2015 02:13:07 GMT</pubDate>
    <dc:creator>wiz</dc:creator>
    <dc:date>2015-05-18T02:13:07Z</dc:date>
    <item>
      <title>HELP!!How to write the python script?</title>
      <link>https://community.esri.com/t5/python-questions/help-how-to-write-the-python-script/m-p/424657#M33332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;Here is the question:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;There are two geodatabases (Village.gdb and Town.gdb). Village.gdb contains 277 feature classes, and every feature class has 10 fields (only Shape_area will be used) and many records. Town.gdb has only one feature class called town277, which has 6 fields (only town_name and Sum_area will be used) and 277 records.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;Now, I want to sum the Shape_area of every feature class in village.gdb, and then assign the values to Sum_area, which the values of town_name equal to the name of 277 feature class in village.gdb.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;So, how to write the python script?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;TKS!!!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2015 01:29:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-how-to-write-the-python-script/m-p/424657#M33332</guid>
      <dc:creator>wiz</dc:creator>
      <dc:date>2015-05-18T01:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: HELP!!How to write the python script?</title>
      <link>https://community.esri.com/t5/python-questions/help-how-to-write-the-python-script/m-p/424658#M33333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you can do it manually check out my&lt;A _jive_internal="true" href="https://community.esri.com/servlet/JiveServlet/download/38-106021/ScriptStubToPythonScript.pdf"&gt; blog post&lt;/A&gt; here and the one referenced in it. It goes through some of the options one has to create scripts for manual processes.&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2015 01:40:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-how-to-write-the-python-script/m-p/424658#M33333</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-05-18T01:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: HELP!!How to write the python script?</title>
      <link>https://community.esri.com/t5/python-questions/help-how-to-write-the-python-script/m-p/424659#M33334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan, TKS for the reply.&lt;/P&gt;&lt;P&gt;I am a Chinese student, and a beginner in python language. So, it is a little difficult in reading all the python scripts in your blog.Could u please point out which post is?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TKS a lot!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Zheng,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2015 02:13:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-how-to-write-the-python-script/m-p/424659#M33334</guid>
      <dc:creator>wiz</dc:creator>
      <dc:date>2015-05-18T02:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: HELP!!How to write the python script?</title>
      <link>https://community.esri.com/t5/python-questions/help-how-to-write-the-python-script/m-p/424660#M33335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Wi, I think what Dan is trying to tell you, is that you can use&amp;nbsp; various tools to make a start on writing a script. One method is to construct a model in model builder to do what you need, and then export the model as a python script. Basically you are going to need to iterate through the feature classes in your Village gdb.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2015 03:00:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-how-to-write-the-python-script/m-p/424660#M33335</guid>
      <dc:creator>SepheFox</dc:creator>
      <dc:date>2015-05-18T03:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: HELP!!How to write the python script?</title>
      <link>https://community.esri.com/t5/python-questions/help-how-to-write-the-python-script/m-p/424661#M33336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Wi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a sample code , that does the job . You can still modify it , to make things efficient&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env

#Configuration goes here
vill_fields = ['&lt;SPAN style="font-family: 'Times New Roman', serif; font-size: 16px;"&gt;Shape_area']&lt;/SPAN&gt;
town_fields = ['&lt;SPAN style="font-family: 'Times New Roman', serif; font-size: 16px;"&gt;Sum_area&lt;/SPAN&gt;']


env.workspace = r'D:\Geonet\geodbase\village.gdb'
village_List =&amp;nbsp; arcpy.ListFeatureClasses()&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;#pushing all the fc's into a list&lt;/SPAN&gt;
town = r'D:\Geonet\geodbase\town.gdb\base'

def findTotalArea(fc):
&amp;nbsp; with arcpy.da.SearchCursor(fc,vill_fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varea = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varea = varea+row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return varea

for fc in village_List:
&amp;nbsp; farea =&amp;nbsp; findTotalArea(fc)
&amp;nbsp; with arcpy.da.UpdateCursor(town,town_fields,"&lt;SPAN style="font-family: 'Times New Roman', serif; font-size: 16px;"&gt;town_name &lt;/SPAN&gt;= '" + fc + "'" ) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0] = farea
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:09:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-how-to-write-the-python-script/m-p/424661#M33336</guid>
      <dc:creator>JaiSiva1</dc:creator>
      <dc:date>2021-12-11T19:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: HELP!!How to write the python script?</title>
      <link>https://community.esri.com/t5/python-questions/help-how-to-write-the-python-script/m-p/424662#M33337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jai, thank you for your help, it works!&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2015 06:55:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-how-to-write-the-python-script/m-p/424662#M33337</guid>
      <dc:creator>wiz</dc:creator>
      <dc:date>2015-05-18T06:55:10Z</dc:date>
    </item>
  </channel>
</rss>

