<?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: AddField_management question in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/addfield-management-question/m-p/414707#M32665</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yeah, after talking with a co-worker this solution just popped into my head. I haven't tried it out yet, but it makes sense.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Mar 2012 15:06:07 GMT</pubDate>
    <dc:creator>deleted-user-rQoEFM5qzbHE</dc:creator>
    <dc:date>2012-03-20T15:06:07Z</dc:date>
    <item>
      <title>AddField_management question</title>
      <link>https://community.esri.com/t5/python-questions/addfield-management-question/m-p/414705#M32663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I need to add multiple fields based on a numerical value and would like to set this up in a for loop based on the numerical value. I have tried in the past to concatenate a string with a number, but have had no luck. As a work around, I had to add in multiple lines of code to add fields (enough to ensure that I add enough fields). As an example, this is what I would like to do:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;max = 20&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for i = 1 to max:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; arcpy.AddField_management(InFC, "Field_" + str(i), ...)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Something to this effect. I have tried a couple of different ways to do this in the past, but haven't had any success. Is this possible?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 12:41:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addfield-management-question/m-p/414705#M32663</guid>
      <dc:creator>deleted-user-rQoEFM5qzbHE</dc:creator>
      <dc:date>2012-03-20T12:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: AddField_management question</title>
      <link>https://community.esri.com/t5/python-questions/addfield-management-question/m-p/414706#M32664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jeremy, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;something like this should work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

max = 5
infile = r"e:\test\test.shp"

for i in range(1,max+1):&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; fname = "Field_"+str(i)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(infile, fname, "DOUBLE") #starts with "Field_1", ends with "Field_5"
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:48:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addfield-management-question/m-p/414706#M32664</guid>
      <dc:creator>RaphaelR</dc:creator>
      <dc:date>2021-12-11T18:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: AddField_management question</title>
      <link>https://community.esri.com/t5/python-questions/addfield-management-question/m-p/414707#M32665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yeah, after talking with a co-worker this solution just popped into my head. I haven't tried it out yet, but it makes sense.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 15:06:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/addfield-management-question/m-p/414707#M32665</guid>
      <dc:creator>deleted-user-rQoEFM5qzbHE</dc:creator>
      <dc:date>2012-03-20T15:06:07Z</dc:date>
    </item>
  </channel>
</rss>

