<?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: Alternative to concatenate field values in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163850#M12559</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;do you mean....&lt;/P&gt;&lt;P&gt;print( "{},&amp;nbsp; "*len(row)).format(*row))&lt;/P&gt;&lt;P&gt;doesn't work with cursors?&lt;/P&gt;&lt;P&gt;(sorry, I rarely use them) &lt;/P&gt;&lt;P&gt;If it works, then you just need to assembly the values if they aren't "" or None as shown&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 08 May 2016 22:28:17 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2016-05-08T22:28:17Z</dc:date>
    <item>
      <title>Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163845#M12554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm creating a single feature class that will represent environmental areas within my study area. The environmental feature class is made up multiple feature classes that was &lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/merge.htm"&gt;merged&lt;/A&gt;, then &lt;A href="http://http//desktop.arcgis.com/en/arcmap/10.3/tools/analysis-toolbox/union.htm"&gt;union-ed&lt;/A&gt; . Each of the feature classes that were merged can contain a field "TYPE_RIV", "TYPE_WET", "TYPE_CBA", "TYPE_PROTECT".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'm trying to achieve is a better way of populating a new field "TYPE" that will concatenate the TYPE field (i.e. "TYPE_RIV", "TYPE_WET" etc.) values automatically based on the input environmental feature classes as this can differ from study area to study area. In other words in some cases there will be "TYPE_RIV", "TYPE_WET" and other cases there will be "TYPE_RIV", "TYPE_WET", "TYPE_CBA" lastly "TYPE_RIV", "TYPE_WET", "TYPE_CBA", "TYPE_PROTECT"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once I've merged and union-ed the input feature classes, I'd like to identify the "TYPE_*" fields and concatenate the field fields into the new "TYPE" fields as per below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="199046" alt="TYPE_Field_Populated.png" class="image-1 jive-image" height="217" src="https://community.esri.com/legacyfs/online/199046_TYPE_Field_Populated.png" style="height: 217px; width: 280.431px;" width="280" /&gt;&lt;/P&gt;&lt;P&gt;End Result Required:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="199047" alt="type_codeblock.png" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/199047_type_codeblock.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;Current Code Block to Populate "TYPE" field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can easily get the "TYPE_*" fields using s a list fields search, but how can an automatically populate the "TYPE" field concatenating the fields correctly based on the fields within the list as the if statements are hard coded and not sure how to get around the following.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 May 2016 15:12:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163845#M12554</guid>
      <dc:creator>PeterWilson</dc:creator>
      <dc:date>2016-05-08T15:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163846#M12555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;P&gt;You can construct a def from the example.&lt;/P&gt;&lt;P&gt;The key is to input your fields in the desired order of concatenation.&lt;/P&gt;&lt;P&gt;If a field is empty ("" or None, depending upont he database), then leave it out.&lt;/P&gt;&lt;P&gt;Format your concatenation string from a list of the good entries.&lt;/P&gt;&lt;P&gt;Pretend you have fields a,b,c,d,e with stuff inside...doesn't matter what, it will end up as a string, if unsure add {!s:} inside the curly braces. Play with this as a script, then 'def' it with&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;a = "A"
b = ""
c = "C"
d = None
e = "E"
flds = [a, b, c, d, e] # put in the ! marks
good = [ val for val in flds if val not in ["",None]] # LC omitting "", aka empty, can add None check
frmt = ("{},&amp;nbsp; "*len(good)).format(*good)
print(frmt[:-2])&lt;/PRE&gt;&lt;P&gt;play with this, if you want commas etc separating, you can play with string strip methods, but I prefer parsing the length.&lt;/P&gt;&lt;P&gt;so as a function, you only need to provide the field names in the correct order to the function, the names don't matter and the concatenation will proceed as expected, regardless of the number of fields or their content.&amp;nbsp; Check my blog for List comprehension and formatting posts for more information&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migration-blogpost/55413" target="_blank"&gt;The ...py... links&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:34:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163846#M12555</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T08:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163847#M12556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following works great, just can't figure out how to use the following within an update cursor:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following is how far I've gotten:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# environmental features within each settlement
def environmental_features(enviro_input):
&amp;nbsp;&amp;nbsp;&amp;nbsp; enviro_intersect = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fcs in enviro_input:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; orig_name = arcpy.Describe(fcs).name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input_features = ["Settlements_Amended", orig_name]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; intersect_name = "{0}\\{1}_int".format("in_memory", orig_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Intersect_analysis(input_features, intersect_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; enviro_intersect.append(intersect_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; merge_name = "{0}\\{1}_merge".format("in_memory", "Environmental")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Merge_management(enviro_intersect, merge_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; diss_name = "{0}\\{1}_diss".format(input_fgdb, "Environmental")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Union_analysis(merge_name, diss_name, "ALL")
&amp;nbsp;&amp;nbsp;&amp;nbsp; field_name = "ENVIRO_TYPE"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(diss_name, "ENVIRO_TYPE",
&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;&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; "TEXT",
&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;&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; field_length=100)
&amp;nbsp;&amp;nbsp;&amp;nbsp; field_names = [f.name for f in arcpy.ListFields(diss_name, "TYPE*", "TEXT")]
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur_fields = list(field_names)
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur_fields.append(field_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(diss_name, cur_fields)as ucur:&amp;nbsp; # @UndefinedVariable
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in ucur:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row[0], row[1]&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Update_Cursor_Results.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/199083_Update_Cursor_Results.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:34:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163847#M12556</guid>
      <dc:creator>PeterWilson</dc:creator>
      <dc:date>2021-12-11T08:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163848#M12557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so are you needing to implement the good and frmt lines in my example?&amp;nbsp; you have cur_fields which is the equivalent to my flds (assuming they are field names and not field objects), then you have the frmt line which removes any "" or None (which you now have because you must be working with a gdb).&amp;nbsp; so did you try appending with mods the salient lines into your function?&amp;nbsp; so row 23 is where you do the concatenation of those field values that have values.&amp;nbsp; Cavaet...the order of the fields determines the order of the outputs, that is where the field calculator expression offers some flexibility&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 May 2016 21:07:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163848#M12557</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-05-08T21:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163849#M12558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan&lt;/P&gt;&lt;P&gt;The problem is that I'm not sure how to get the field &lt;STRONG&gt;values&lt;/STRONG&gt; without having to specify the field index and the last field row[2] = ""ENVIRO_TYPE", is the field I need to update. row[0] = "TYPE_RIV", row[1] = "TYPE_WET" this time but it won't always be the case. Any suggestions welcome &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Update_Cursor_Results2.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/199048_Update_Cursor_Results2.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;Print Statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# environmental features within each settlement
def environmental_features(enviro_input):
&amp;nbsp;&amp;nbsp;&amp;nbsp; enviro_intersect = []
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fcs in enviro_input:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; orig_name = arcpy.Describe(fcs).name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input_features = ["Settlements_Amended", orig_name]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; intersect_name = "{0}\\{1}_int".format("in_memory", orig_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Intersect_analysis(input_features, intersect_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; enviro_intersect.append(intersect_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; merge_name = "{0}\\{1}_merge".format("in_memory", "Environmental")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Merge_management(enviro_intersect, merge_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; diss_name = "{0}\\{1}_diss".format("in_memory", "Environmental")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Union_analysis(merge_name, diss_name, "ALL")
&amp;nbsp;&amp;nbsp;&amp;nbsp; field_name = "ENVIRO_TYPE"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(diss_name, "ENVIRO_TYPE",
&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;&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; "TEXT",
&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;&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; field_length=100)
&amp;nbsp;&amp;nbsp;&amp;nbsp; field_names = [f.name for f in arcpy.ListFields(diss_name, "TYPE*", "TEXT")]
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur_fields = list(field_names)
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur_fields.append(field_name)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print cur_fields
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(diss_name, cur_fields)as ucur:&amp;nbsp; # @UndefinedVariable
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in ucur:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row[0], row[1], row[2]&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Python Code:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:34:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163849#M12558</guid>
      <dc:creator>PeterWilson</dc:creator>
      <dc:date>2021-12-11T08:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163850#M12559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;do you mean....&lt;/P&gt;&lt;P&gt;print( "{},&amp;nbsp; "*len(row)).format(*row))&lt;/P&gt;&lt;P&gt;doesn't work with cursors?&lt;/P&gt;&lt;P&gt;(sorry, I rarely use them) &lt;/P&gt;&lt;P&gt;If it works, then you just need to assembly the values if they aren't "" or None as shown&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 May 2016 22:28:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163850#M12559</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-05-08T22:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163851#M12560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use range and a field list see below.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;field_list = ["field1","field2","field3"]
build = ""
for x in range(len(field_list)):
&amp;nbsp; build+=str(x)
print build
'012'&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:34:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163851#M12560</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2021-12-11T08:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163852#M12561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan&lt;/P&gt;&lt;P&gt;I've used slicing to select the correct fields that are defined within my UpdateCursor as the fields are made up of:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;"TYPE_RIV", "TYPE_WET", "TYPE_CBA" (&lt;STRONG&gt;input to good)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;"ENVIRO_TYPE" (&lt;STRONG&gt;output field to be populated&lt;/STRONG&gt;)&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;field_name = "ENVIRO_TYPE"
arcpy.AddField_management(union_name, "ENVIRO_TYPE", "TEXT", field_length=100)
enviro_fields = [f.name for f in arcpy.ListFields(union_name, "TYPE*", "TEXT")]
enviro_fields.append(field_name)
with arcpy.da.UpdateCursor(union_name, enviro_fields )as upcur:&amp;nbsp; # @UndefinedVariable
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in upcur:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; good = [val for val in list(row[:-1]) if val not in["", None]]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; frmt = ("{}, "*len(good)).format(*good)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[-1] = frmt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; upcur.updateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row[-1]&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="199118" alt="Update_Cursor_Results3.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/199118_Update_Cursor_Results3.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;Thanks for all the help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:34:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163852#M12561</guid>
      <dc:creator>PeterWilson</dc:creator>
      <dc:date>2021-12-11T08:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163853#M12562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;now if you want to get rid of that pesky ", " at the end, then you can simply use the slice of frmt[:-2] for that&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2016 14:03:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163853#M12562</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-05-09T14:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163854#M12563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Was just thinking about that. I was considering using a nested if statement to test the length of records for each row to remove the&amp;nbsp; &lt;STRONG&gt;"space"&lt;/STRONG&gt; after the &lt;STRONG&gt;","&lt;/STRONG&gt; where there is only one item and to remove the &lt;STRONG&gt;","&lt;/STRONG&gt; at the end.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2016 14:24:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163854#M12563</guid>
      <dc:creator>PeterWilson</dc:creator>
      <dc:date>2016-05-09T14:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163855#M12564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following dealt with both the &lt;STRONG&gt;"space"&lt;/STRONG&gt; and &lt;STRONG&gt;","&lt;/STRONG&gt; thanks so much &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2016 14:35:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163855#M12564</guid>
      <dc:creator>PeterWilson</dc:creator>
      <dc:date>2016-05-09T14:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163856#M12565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The &lt;SPAN style="font-family: courier new,courier;"&gt;str.join()&lt;/SPAN&gt; method works well when concatenating like this, and one doesn't have to remove extra commas:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; flds = ["hi&amp;nbsp; ", 2, None, "", "&amp;nbsp; bye"]
&amp;gt;&amp;gt;&amp;gt; ",".join(str.strip(str(x)) &lt;SPAN style="color: #004da8;"&gt;for&lt;/SPAN&gt; x &lt;SPAN style="color: #004da8;"&gt;in&lt;/SPAN&gt; flds &lt;SPAN style="color: #004da8;"&gt;if&lt;/SPAN&gt; x &lt;SPAN style="color: #004da8;"&gt;not&lt;/SPAN&gt; &lt;SPAN style="color: #004da8;"&gt;in&lt;/SPAN&gt; ["",None])
'hi,2,bye'&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:35:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163856#M12565</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T08:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163857#M12566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joshua&lt;/P&gt;&lt;P&gt;The&amp;nbsp; "&lt;STRONG&gt;spaces&lt;/STRONG&gt;" and &lt;STRONG&gt;","&lt;/STRONG&gt; are required between the strings i.e. "&lt;STRONG&gt;Rivers, Wetlands&lt;/STRONG&gt;". The removal of the "&lt;STRONG&gt;spaces&lt;/STRONG&gt;" and &lt;STRONG&gt;","&lt;/STRONG&gt; are those at the end of the concatenated string i.e. &lt;STRONG&gt;"Rivers, Wetlands,space"&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2016 19:20:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163857#M12566</guid>
      <dc:creator>PeterWilson</dc:creator>
      <dc:date>2016-05-09T19:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163858#M12567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just add a space after the comma with the join method:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; flds = [&lt;SPAN class="string"&gt;"hi&amp;nbsp; ", &lt;SPAN class="number"&gt;2&lt;/SPAN&gt;, &lt;SPAN class="special"&gt;None&lt;/SPAN&gt;, "&lt;SPAN class="string"&gt;", "&lt;/SPAN&gt;&amp;nbsp; bye"]&amp;nbsp; &lt;/SPAN&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;SPAN class="string"&gt;", ".join(str.strip(str(x)) &lt;SPAN class="keyword"&gt;for&lt;/SPAN&gt; x &lt;SPAN class="keyword"&gt;in&lt;/SPAN&gt; flds &lt;SPAN class="keyword"&gt;if&lt;/SPAN&gt; x &lt;SPAN class="keyword"&gt;not&lt;/SPAN&gt; &lt;SPAN class="keyword"&gt;in&lt;/SPAN&gt; ["",&lt;SPAN class="special"&gt;None&lt;/SPAN&gt;])&amp;nbsp; &lt;/SPAN&gt;
&lt;SPAN class="string"&gt;'hi, 2, bye'&amp;nbsp; &lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:35:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163858#M12567</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T08:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to concatenate field values</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163859#M12568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Joshua, yes, join is useful as well.&amp;nbsp; I am just used to slicing since I work with arrays mostly for geometry and attributes.&amp;nbsp; You could leave the strip out if you wanted to retain blank spaces should {} be used&lt;/P&gt;&lt;P&gt;On a simpler case, the mini-formatting language offers some nice options&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
&amp;gt;&amp;gt;&amp;gt; b = ", ".join(str.strip(str(i)) for i in a)
&amp;gt;&amp;gt;&amp;gt; c = ("{}, "*len(a)).format(*a)[:-2]
&amp;gt;&amp;gt;&amp;gt; c1 = ("{!s:&amp;gt;03}, "*len(a)).format(*a)[:-2]
&amp;gt;&amp;gt;&amp;gt; c2 = ("{!r:&amp;gt;03}, "*len(a)).format(*a)[:-2]
&amp;gt;&amp;gt;&amp;gt; b
'0, 1, 2, 3, 4, 5, 6, 7, 8, 9'
&amp;gt;&amp;gt;&amp;gt; c
'0, 1, 2, 3, 4, 5, 6, 7, 8, 9'
&amp;gt;&amp;gt;&amp;gt; c1
'000, 001, 002, 003, 004, 005, 006, 007, 008, 009'&lt;/PRE&gt;&lt;P&gt;especially if you are replicating an input like a join string, the ("{...}"*len(...)) is&amp;nbsp; an alternate.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:35:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-concatenate-field-values/m-p/163859#M12568</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T08:35:06Z</dc:date>
    </item>
  </channel>
</rss>

