<?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 replace characters label ArcMap in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112815#M62854</link>
    <description>&lt;PRE&gt;&lt;SPAN class=""&gt;Hey!
I wish to use replace twice in the same field.&lt;BR /&gt;Attributes: &amp;gt;0980&amp;gt;Visy&amp;gt; GA: 8 must be labeled GA:8.&lt;BR /&gt;I use def FindLabel ([externid]):
  return [externid] .replace ('0980&amp;gt;Visy', ''), but fails to add code so that even the last &amp;gt; disappear.&lt;BR /&gt; Anyone know how to write it?&lt;BR /&gt;Best regards,&lt;BR /&gt;Tomas&lt;/SPAN&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 01 Nov 2021 12:14:58 GMT</pubDate>
    <dc:creator>TomasLooström</dc:creator>
    <dc:date>2021-11-01T12:14:58Z</dc:date>
    <item>
      <title>replace characters label ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112815#M62854</link>
      <description>&lt;PRE&gt;&lt;SPAN class=""&gt;Hey!
I wish to use replace twice in the same field.&lt;BR /&gt;Attributes: &amp;gt;0980&amp;gt;Visy&amp;gt; GA: 8 must be labeled GA:8.&lt;BR /&gt;I use def FindLabel ([externid]):
  return [externid] .replace ('0980&amp;gt;Visy', ''), but fails to add code so that even the last &amp;gt; disappear.&lt;BR /&gt; Anyone know how to write it?&lt;BR /&gt;Best regards,&lt;BR /&gt;Tomas&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Nov 2021 12:14:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112815#M62854</guid>
      <dc:creator>TomasLooström</dc:creator>
      <dc:date>2021-11-01T12:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters label ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112818#M62855</link>
      <description>&lt;P&gt;replace replaces the whatever string you put in the first parameter so you need to be explicit with what you want replaced.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;.replace('&amp;gt;0980&amp;gt;Visy&amp;gt;', '')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 12:25:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112818#M62855</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-11-01T12:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters label ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112820#M62856</link>
      <description>&lt;PRE&gt;&lt;SPAN class=""&gt;Thanks for the reply!&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;I missed writing that Visy can consist of different names, it varies and can then be Fran instead of Visy.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 12:34:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112820#M62856</guid>
      <dc:creator>TomasLooström</dc:creator>
      <dc:date>2021-11-01T12:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters label ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112821#M62857</link>
      <description>&lt;P&gt;Check if a similar script works&lt;/P&gt;&lt;P&gt;Parser: Python&lt;/P&gt;&lt;LI-CODE lang="python"&gt;(!FieldName!.split(' ',1)[1]).replace(' ','')&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 01 Nov 2021 12:35:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112821#M62857</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2021-11-01T12:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters label ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112823#M62858</link>
      <description>&lt;P&gt;Without getting to regex, you can chain them with what you need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;.replace('&amp;gt;0980&amp;gt;Visy&amp;gt;', '').replace('&amp;gt;0980&amp;gt;Fran&amp;gt;', '')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; If there are a lot, you can create a loop to iterate through all the variations from a list and replace them. Assuming there is a space there between the last &amp;gt; and GA:8,or you can find another way to parse out the part you want to replace.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for str in [str[0].split(' ')[0] for str in arcpy.da.SearchCursor(yourfc, [externid])]:
   [exernid].replace(str, '')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or index it as Jayanta provided.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;[externid].split('&amp;gt;')[-1]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 12:46:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112823#M62858</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-11-01T12:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters label ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112828#M62859</link>
      <description>&lt;P&gt;&lt;SPAN&gt;When I use .replace ('&amp;gt; 0980&amp;gt; Visy&amp;gt;', '') .replace ('&amp;gt; 0980&amp;gt; Fran&amp;gt;', '') then&amp;gt; 0980&amp;gt;Visy is included in the labeling but last&amp;gt; disappears.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 12:49:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112828#M62859</guid>
      <dc:creator>TomasLooström</dc:creator>
      <dc:date>2021-11-01T12:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters label ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112831#M62860</link>
      <description>&lt;P&gt;Is there some that contains spaces (&amp;gt; 0980&amp;gt; Visy&amp;gt;) and others that do not (&amp;gt;0980&amp;gt;Visy) in your field?&amp;nbsp; If that is the case, I'd suggest using&lt;/P&gt;&lt;LI-CODE lang="python"&gt;[externid].split('&amp;gt;')[-1].strip()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 12:52:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112831#M62860</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-11-01T12:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: replace characters label ArcMap</title>
      <link>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112833#M62861</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks, it works!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 13:09:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/replace-characters-label-arcmap/m-p/1112833#M62861</guid>
      <dc:creator>TomasLooström</dc:creator>
      <dc:date>2021-11-01T13:09:34Z</dc:date>
    </item>
  </channel>
</rss>

