<?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: how to update field with name of FC for list of FCs ? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553956#M43283</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could do something like this (if you have ArcGIS 10.1 SP1 or higher):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os

# settings for field
fld_name = "Particle"
fld_type = "TEXT"
fld_length = 20

# set you workspace (where the fc's are located)
ws = r"C:\Path\To\Your\Folder\or\fgdb.gdb"
arcpy.env.workspace = ws

fcs =&amp;nbsp; arcpy.ListFeatureClasses()
for fc_name in fcs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = os.path.join(ws, fc_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # add field, if it doesn't exist
&amp;nbsp;&amp;nbsp;&amp;nbsp; if len(arcpy.ListFields(fc, wilc_card=fld_name)) == 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, fld_name, fld_type, field_length=fld_length)

&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(fc, (fld_name)) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0] = fc_name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.updateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp; del curs, row&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 23:56:32 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2021-12-11T23:56:32Z</dc:date>
    <item>
      <title>how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553952#M43279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everybody - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to fill in the attribute in a newly created field 'Particle', with the name of the FC, which will be changing for a list of FCs. I've tried using 'CalculateField', with which I get the error: 'NameError: name 'xy_1' is not defined', where 'xy_1' is the name of the FC going through the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried using 'UpdateCursor' and I get the error: "&amp;nbsp; 'list' object has no attribute 'setValue'&amp;nbsp; ".&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code I've written so far:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fieldName1 = "Particle"&lt;/P&gt;&lt;P&gt;fieldType1 = "TEXT"&lt;/P&gt;&lt;P&gt;fieldlength = 20&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wildcard = ""&lt;/P&gt;&lt;P&gt;fctype = ""&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcList =&amp;nbsp; arcpy.ListFeatureClasses(wildcard, fctype)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # print fcList2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in fcList:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print fc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc,fieldName1,fieldType1,"","",fieldlength,"","NULLABLE")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[with:]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(fc)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val = desc.name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print val&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(fc, fieldName1, val, "PYTHON_9.3")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[OR:]&lt;/P&gt;&lt;P&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs =&amp;nbsp; arcpy.da.UpdateCursor(fc,fieldName1)&lt;/P&gt;&lt;P&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:&lt;/P&gt;&lt;P&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(fc)&lt;/P&gt;&lt;P&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val = desc.name&lt;/P&gt;&lt;P&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print val&lt;/P&gt;&lt;P&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(fieldName1,val)&lt;/P&gt;&lt;P&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.updateRow(row)&lt;/P&gt;&lt;P&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del curs, row&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Feb 2015 22:49:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553952#M43279</guid>
      <dc:creator>GabrielBacca-Cortes</dc:creator>
      <dc:date>2015-02-10T22:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553953#M43280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Review the documentation on ArcPy Data Access cursors.&amp;nbsp; The arcpy.da update cursor doesn't have a setValue method, that was for the older-style update cursor.&amp;nbsp; You are effectively mixing up the syntax for the two types of cursors.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Feb 2015 23:00:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553953#M43280</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-02-10T23:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553954#M43281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With CalculateField_management, try removing "PYTHON_9.3".&amp;nbsp; You aren't actually passing an expression, just a value.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Feb 2015 23:09:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553954#M43281</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-02-10T23:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553955#M43282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gabriel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It look like you may be confusing how you are using cursors in python.&amp;nbsp; The Data Access module cursors have some distinct differences.&amp;nbsp; You don't need to specify the field for your cursor.&amp;nbsp; This might work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs =&amp;nbsp; arcpy.UpdateCursor(fc)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(fc)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; val = desc.name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print val&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(fieldName1,val)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.updateRow(row)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del curs, row&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice that I have removed the .da. from your cursor reference and indented the updateRow line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Feb 2015 23:11:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553955#M43282</guid>
      <dc:creator>TomSellsted</dc:creator>
      <dc:date>2015-02-10T23:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553956#M43283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could do something like this (if you have ArcGIS 10.1 SP1 or higher):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os

# settings for field
fld_name = "Particle"
fld_type = "TEXT"
fld_length = 20

# set you workspace (where the fc's are located)
ws = r"C:\Path\To\Your\Folder\or\fgdb.gdb"
arcpy.env.workspace = ws

fcs =&amp;nbsp; arcpy.ListFeatureClasses()
for fc_name in fcs:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = os.path.join(ws, fc_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; # add field, if it doesn't exist
&amp;nbsp;&amp;nbsp;&amp;nbsp; if len(arcpy.ListFields(fc, wilc_card=fld_name)) == 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, fld_name, fld_type, field_length=fld_length)

&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(fc, (fld_name)) as curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0] = fc_name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.updateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp; del curs, row&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:56:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553956#M43283</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T23:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553957#M43284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Joshua -&amp;nbsp; Yes, you're right I was mixing up 'da' cursors with the older version.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 14:46:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553957#M43284</guid>
      <dc:creator>GabrielBacca-Cortes</dc:creator>
      <dc:date>2015-02-11T14:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553958#M43285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom -&amp;nbsp; thanks for the response.&amp;nbsp; Yes, I was mixing 'DA' cursors with the older version.&lt;/P&gt;&lt;P&gt;the changes worked.&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Gabriel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 14:47:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553958#M43285</guid>
      <dc:creator>GabrielBacca-Cortes</dc:creator>
      <dc:date>2015-02-11T14:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553959#M43286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks Xander - this works too, for a more general case.&amp;nbsp; Thanks again.. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 14:52:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553959#M43286</guid>
      <dc:creator>GabrielBacca-Cortes</dc:creator>
      <dc:date>2015-02-11T14:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553960#M43287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Xander -&amp;nbsp; this general version works great when one has to re-run the script through the same set of FCs without redoing previous work. I am sure you knew this but I just figured it out, &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; Thanks a bunch !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 15:40:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553960#M43287</guid>
      <dc:creator>GabrielBacca-Cortes</dc:creator>
      <dc:date>2015-02-11T15:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553961#M43288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're welcome...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 15:46:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553961#M43288</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-02-11T15:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553962#M43289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are welcome Gabriel!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 15:52:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553962#M43289</guid>
      <dc:creator>TomSellsted</dc:creator>
      <dc:date>2015-02-11T15:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553963#M43290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the line where you open the update cursor, why do you have extra parenthesis around &lt;SPAN style="font-family: 'courier new', courier;"&gt;fld_name&lt;/SPAN&gt;?&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14236945852916921 jive_text_macro" jivemacro_uid="_14236945852916921"&gt;&lt;P&gt;with arcpy.da.UpdateCursor(fc, (fld_name)) as curs:&lt;/P&gt;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 22:42:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553963#M43290</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2015-02-11T22:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553964#M43291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Blake,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It must be a tuple.&amp;nbsp; The extra parenthesis make it a tuple.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 22:47:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553964#M43291</guid>
      <dc:creator>TomSellsted</dc:creator>
      <dc:date>2015-02-11T22:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553965#M43292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Blake - yes, it is meant for a list of fields, which in my case is only one.&amp;nbsp; As it is use in this link &lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#/Accessing_data_using_cursors/002z0000001q000000/" title="http://resources.arcgis.com/en/help/main/10.1/index.html#/Accessing_data_using_cursors/002z0000001q000000/"&gt;ArcGIS Help 10.1&lt;/A&gt; , scroll down to the updateRow function.&lt;/P&gt;&lt;P&gt;Gabriel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 22:54:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553965#M43292</guid>
      <dc:creator>GabrielBacca-Cortes</dc:creator>
      <dc:date>2015-02-11T22:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553966#M43293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But the &lt;A href="http://resources.arcgis.com/en/help/main/10.2/018w/018w00000014000000.htm"&gt;Esri documentation&lt;/A&gt; for the Update cursor says:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;For a single field, you can use a string instead of a list of strings.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I'm not trying to be a nit-pick know-it-all, I'm just trying to understand. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 23:04:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553966#M43293</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2015-02-11T23:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553967#M43294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Blake,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are correct, the docs do say you can use a string for a single field.&amp;nbsp; In this case just a coding preference.&amp;nbsp; If you had more fields, the tuple would already be in place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 23:07:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553967#M43294</guid>
      <dc:creator>TomSellsted</dc:creator>
      <dc:date>2015-02-11T23:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to update field with name of FC for list of FCs ?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553968#M43295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, yes, I follow now. However, I think you have to put an extra comma after the variable inside the parenthesis to make it a true tuple.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fld_name = "Particle"
print fld_name
print (fld_name)
print (fld_name,)&lt;/PRE&gt;&lt;P&gt;produces:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Particle
Particle
('Particle',)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:56:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-update-field-with-name-of-fc-for-list-of/m-p/553968#M43295</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-12-11T23:56:34Z</dc:date>
    </item>
  </channel>
</rss>

