<?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: Add Fields in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/add-fields/m-p/531745#M41628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Marc !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;best regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;nils-demian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 31 May 2013 10:40:48 GMT</pubDate>
    <dc:creator>NilsLandmeyer</dc:creator>
    <dc:date>2013-05-31T10:40:48Z</dc:date>
    <item>
      <title>Add Fields</title>
      <link>https://community.esri.com/t5/python-questions/add-fields/m-p/531743#M41626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;is it possible with a phyton code to add more than 1 Field to a Table?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have to calculate a few Fields in the Modelbuilder and would like to add these new Fields at once.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;nils-demian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 May 2013 06:38:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-fields/m-p/531743#M41626</guid>
      <dc:creator>NilsLandmeyer</dc:creator>
      <dc:date>2013-05-31T06:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Add Fields</title>
      <link>https://community.esri.com/t5/python-questions/add-fields/m-p/531744#M41627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Nils,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It's possible but I'm not sure it's faster or easier than adding a few more tools in modelbuilder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd put the field names in a list and then you can loop the AddField command through that list. I'm not yet sure how you can handle different datatypes for the fields though. With all fields of the TEXT type it would look like this&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Shapefile = r"C:\xxx\xxx\your shapefile here.shp"
FieldList = ["Field1", "Field2", "Field3", "etc"]

for Column in FieldList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(Shapefile, Column, "TEXT")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can add more parameters after the field type to determine the field length, precision, etc&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this is helpful.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Marc&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:08:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-fields/m-p/531744#M41627</guid>
      <dc:creator>MarcEngelsma1</dc:creator>
      <dc:date>2021-12-11T23:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Add Fields</title>
      <link>https://community.esri.com/t5/python-questions/add-fields/m-p/531745#M41628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Marc !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;best regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;nils-demian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 May 2013 10:40:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-fields/m-p/531745#M41628</guid>
      <dc:creator>NilsLandmeyer</dc:creator>
      <dc:date>2013-05-31T10:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Add Fields</title>
      <link>https://community.esri.com/t5/python-questions/add-fields/m-p/531746#M41629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It isn't going to save you many characters of code, but if you wanted to expand your array idea make it a multi dimensional array or an array of objects.&amp;nbsp; Instead of a string for a field name you have an array, the items in the array could be the parameters for your add field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Shapefile = r"C:\xxx\xxx\your shapefile here.shp"
FieldList = [["Field1","TEXT"], ["Field2","DOUBLE"]]

for Column in FieldList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(Shapefile, Column[0], Column[1])
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:08:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-fields/m-p/531746#M41629</guid>
      <dc:creator>TimDine</dc:creator>
      <dc:date>2021-12-11T23:08:27Z</dc:date>
    </item>
  </channel>
</rss>

