<?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: Field Calculator Expression Arcpy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241646#M18802</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Xander... Yes good... there is a variant that interweaves two lists or portions of a single list too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; years = ['1999', '2000', '2001', '2002', '2003', '2004', '2005', '2006','2007', '2008']
&amp;gt;&amp;gt;&amp;gt; text = [z[0] +"_"+ pair[1] for z in zip(years[:-1], years[1:])]

&amp;gt;&amp;gt;&amp;gt; text
['1999_2000', '2000_2001', '2001_2002', '2002_2003', '2003_2004', '2004_2005', '2005_2006', '2006_2007', '2007_2008']&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; text = ["{}_{}".format(z[0], z[1]) for z in zip(years[:-1], years[1:])] 
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but I do like using the new formatting options so that you don't have to care about casting between strings or text if you don't want to.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 12:07:43 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2021-12-11T12:07:43Z</dc:date>
    <item>
      <title>Field Calculator Expression Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241635#M18791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I am writing a script to perform a Union on multiple feature data sets.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Feature data sets:&amp;nbsp; R1ADS1999Damage, R1ADS2000Damage.....R1ADS2013Damage&amp;nbsp; (these are all polygon feature classes with the same attribute fields years 1999-2013)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to join the first (1999) year to the next year, naming the joined feature class R1ADS1999-2000Damage, and then add three new fields called: TPA_1999_2000; Acres_1999_2000 and; NoTrees_1999_2000.&amp;nbsp; Each new field is calculated with a unique (field calculator) expression.&amp;nbsp; I will provide these calculations in a moment.&amp;nbsp; Once the fields are added and the values calculated the newly created unioned feature class, R1ADS1999-2000Damage, needs to be unioned to R1ADS2001Damage, the next chronological year. Fields called&amp;nbsp; TPA_1999_2001; Acres_1999_2001 and; NoTrees_1999_2001&amp;nbsp; need to be added and calculated.&amp;nbsp; This pattern continues until the final year 2013.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TPA_1999_2000 = Is the sum of field TPA_1999 + TPA_2000, after the next union the TPA_1999_2001= TPA_1999_2000+TPA_2001 this pattern continues for after all unions.&lt;/P&gt;&lt;P&gt;Acres_1999_2000= Is a recalculation of geometry after the union, in Acres. This is the same for all subsequent unions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No_Trees_1999_2000= Is TPA_1999_2000 * Acres_1999_2000. After the next union the NoTrees_1999_2001= TPA_1999_2001*Acres1999_2001&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have managed to get the union and adding fields part of the script done, see below.&amp;nbsp; I got stuck on writing the Field Calculator expression for the TPA_1999_20XX.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems that I need an expression that sums all of the fields that begin with TPA_&amp;nbsp; something like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TPA_1999_2000= sum([!TPA_*!)&amp;nbsp;&amp;nbsp; However this does not work.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So here is the code I have come up with so far until got stuck:&lt;/P&gt;&lt;P&gt;##################################################&lt;/P&gt;&lt;P&gt;R1=&lt;SPAN style="color: #3d3d3d;"&gt;"R1ADS"&lt;BR /&gt;Dam="Damage"&lt;BR /&gt;years=['1999','2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013']&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;fields=['TPA_','Acres_','NoTrees_']&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;RangeYear= &lt;SPAN style="color: #3d3d3d;"&gt;['1999_2000','1999_2001','1999_2002','1999_2003','1999_2004','1999_2005','1999_2006','1999_2007','1999_2008','1999_2009','1999_2010','1999_2011','1999_2012','1999_2013']&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;expression=['TPA_ expression', 'Acres_expression', 'NoTree_expession'] ### Note these are place holders for the correct expressions that I need help with.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;arcpy.Union_analysis([R1+years[&lt;SPAN style="color: #6897bb;"&gt;0&lt;/SPAN&gt;]+Dam&lt;SPAN style="color: #cc7832;"&gt;,&lt;/SPAN&gt;R1+years[&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;]+Dam]&lt;SPAN style="color: #cc7832;"&gt;,&lt;/SPAN&gt;R1+years[&lt;SPAN style="color: #6897bb;"&gt;0&lt;/SPAN&gt;]+&lt;SPAN style="color: #a5c261;"&gt;"_"&lt;/SPAN&gt;+years[&lt;SPAN style="color: #6897bb;"&gt;1&lt;/SPAN&gt;]+Dam)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: bold;"&gt;for &lt;/SPAN&gt;i &lt;SPAN style="font-weight: bold;"&gt;in &lt;/SPAN&gt;range(0,13) :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp; arcpy.Union_analysis([R1+years[0]+"_"+years[i+1]+Dam,R1+years[i+2]+Dam],R1+years[0]+"_"+years[i+2]+Dam)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp; &lt;SPAN style="font-weight: bold;"&gt;print &lt;/SPAN&gt;years[0]+'_'+years[i+2]+" union done"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #3d3d3d;"&gt; for &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d;"&gt;j &lt;SPAN style="font-weight: bold;"&gt;in &lt;/SPAN&gt;range(0,3):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(R1+years[0]+'_'+years[i+2]+Dam, fields&lt;J&gt;+RangeYear&lt;I&gt;, "FLOAT","","","")&lt;/I&gt;&lt;/J&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_Management(&lt;SPAN style="color: #3d3d3d;"&gt;R1+years[0]+'_'+years[i+2]+Dam, fields&lt;J&gt;+RangeYear&lt;I&gt;,expression&lt;J&gt;)&lt;/J&gt;&lt;/I&gt;&lt;/J&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;I would appreciate any help you can give, please do not worry about insulting me I am new to programming.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d;"&gt;Thanks &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jan 2016 23:25:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241635#M18791</guid>
      <dc:creator>HOWARDWILLIAMS</dc:creator>
      <dc:date>2016-01-27T23:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator Expression Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241636#M18792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you writing this in code(which? ie python) or model builder? Are the polys all the same or varying sizes? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: You may also want to move to a more appropriate place GeoNet Help is for help with GeoNet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jan 2016 23:33:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241636#M18792</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2016-01-27T23:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator Expression Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241637#M18793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Wes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am attempting to write this in Python, and it seems to work for most of&lt;/P&gt;&lt;P&gt;the script.  I am using the PyCharm IDE.&lt;/P&gt;&lt;P&gt;I am trying to write a script that will execute a workflow that a&lt;/P&gt;&lt;P&gt;supervisor gave me.  I will look into a spatial join, I wondered the same&lt;/P&gt;&lt;P&gt;thing myself, however I was trying to use the same methods as I was told to&lt;/P&gt;&lt;P&gt;follow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyhow, I thought that this was a place to post arcpy questions, whoops&lt;/P&gt;&lt;P&gt;where do you suggest I post?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jan 2016 23:56:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241637#M18793</guid>
      <dc:creator>HOWARDWILLIAMS</dc:creator>
      <dc:date>2016-01-27T23:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator Expression Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241638#M18794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You would want to move to python.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2016 00:00:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241638#M18794</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2016-01-28T00:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator Expression Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241639#M18795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Wes!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2016 00:07:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241639#M18795</guid>
      <dc:creator>HOWARDWILLIAMS</dc:creator>
      <dc:date>2016-01-28T00:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator Expression Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241640#M18796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are all the polys the same size?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2016 00:22:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241640#M18796</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2016-01-28T00:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator Expression Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241641#M18797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;tooo convoluted to dissect.&amp;nbsp; To expedite, it appears that you have a file which you have managed to get the results into the fields and now you are just having problems getting the field calculator expression to calculate the final field.&amp;nbsp; Do yourself a favour and do it manually once...get the correct functioning syntax from the Results window, then use it in your code.&amp;nbsp; see the attachment in my blog link for details &lt;A href="https://community.esri.com/migration-blogpost/1900"&gt;"You are not allowed to use Modelbuilder": When Instructors need to get smarter&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2016 01:36:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241641#M18797</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-01-28T01:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator Expression Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241642#M18798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ps... do some code formatting...it will help others.&amp;nbsp; This link provides a compendium of recommendations&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migration-blogpost/55181"&gt;Code Formatting... the basics++&lt;/A&gt;&lt;/P&gt;&lt;P&gt;have fun &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2016 01:41:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241642#M18798</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-01-28T01:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator Expression Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241643#M18799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I copy and paste the code to my IDE, I get some syntax errors for the indents.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A small tip on the years and range years lists. You could do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;years = [str(year) for year in range(1999, 2014)]
range_years = ['{0}_{1}'.format(years[0], year) for year in years[1:]]&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or like yours&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;text = ["{}_{}".format(z[0], z[1]) for z in zip(years[:-1], years[1:])] &lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which yields:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;['1999', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013']
['1999_2000', '1999_2001', '1999_2002', '1999_2003', '1999_2004', '1999_2005', '1999_2006', '1999_2007', '1999_2008', '1999_2009', '1999_2010', '1999_2011', '1999_2012', '1999_2013']&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:07:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241643#M18799</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T12:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator Expression Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241644#M18800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the suggestions.&amp;nbsp; I am sorry about the code formatting, I cut and pasted it from an IDE rather than a text editor and it got wired.&amp;nbsp; Anyway, I should have taken more time with snippet I posted.&amp;nbsp; Sorry I was getting frustrated.&amp;nbsp; Great suggestion on the years and range_years.&amp;nbsp; Thanks.&amp;nbsp; Really what I am struggling with the the expression that I have to write in field calculator.&amp;nbsp; It has been suggested that I do it manually first and I have tried, I can can not figure out the syntax for the expression.&amp;nbsp; Anyhow, thanks for the suggestion.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2016 02:54:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241644#M18800</guid>
      <dc:creator>HOWARDWILLIAMS</dc:creator>
      <dc:date>2016-01-28T02:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator Expression Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241645#M18801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, it got weird when I cut and pasted it from my IDE, sorry about that.&amp;nbsp; I will fix it up tomorrow.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Howard &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2016 02:56:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241645#M18801</guid>
      <dc:creator>HOWARDWILLIAMS</dc:creator>
      <dc:date>2016-01-28T02:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculator Expression Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241646#M18802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Xander... Yes good... there is a variant that interweaves two lists or portions of a single list too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; years = ['1999', '2000', '2001', '2002', '2003', '2004', '2005', '2006','2007', '2008']
&amp;gt;&amp;gt;&amp;gt; text = [z[0] +"_"+ pair[1] for z in zip(years[:-1], years[1:])]

&amp;gt;&amp;gt;&amp;gt; text
['1999_2000', '2000_2001', '2001_2002', '2002_2003', '2003_2004', '2004_2005', '2005_2006', '2006_2007', '2007_2008']&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; text = ["{}_{}".format(z[0], z[1]) for z in zip(years[:-1], years[1:])] 
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but I do like using the new formatting options so that you don't have to care about casting between strings or text if you don't want to.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:07:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-expression-arcpy/m-p/241646#M18802</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T12:07:43Z</dc:date>
    </item>
  </channel>
</rss>

