<?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: Deleting last 3 characters using field calculator in ArcGIS Pro (UK Postcode) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/deleting-last-3-characters-using-field-calculator/m-p/306114#M23747</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/3420"&gt;Joshua Bixby&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Joshua Bixby markeerde het antwoord van Emily Catt als juist&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Why did you mark the "Thank you" as the correct answer, and not the actual answer I gave to the question?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just curious &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Egge-Jan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Jul 2019 21:13:31 GMT</pubDate>
    <dc:creator>Egge-Jan_Pollé</dc:creator>
    <dc:date>2019-07-09T21:13:31Z</dc:date>
    <item>
      <title>Deleting last 3 characters using field calculator in ArcGIS Pro (UK Postcode)</title>
      <link>https://community.esri.com/t5/python-questions/deleting-last-3-characters-using-field-calculator/m-p/306110#M23743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have no idea how to use Python but I'm pretty sure there would be a way to do this, it's like using the MID query in excel. I'm using ArcGIS Pro and have a field for UK Postcodes, either in the format E4 9SU, DA12 7JS or DA1 7JS. I am trying to use the Field Calculator to delete the last three characters (4 including the space) so I will be left with either E4, DA12 or DA1&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is anyone able to help in writing the script? as I wouldn't even know where to start. The input field is called Match_Addr so after some research I'm assuming the input would be !Match_addr!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would appreciate any help with this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jul 2019 14:12:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-last-3-characters-using-field-calculator/m-p/306110#M23743</guid>
      <dc:creator>e_cat</dc:creator>
      <dc:date>2019-07-09T14:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting last 3 characters using field calculator in ArcGIS Pro (UK Postcode)</title>
      <link>https://community.esri.com/t5/python-questions/deleting-last-3-characters-using-field-calculator/m-p/306111#M23744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/347248"&gt;Emily Catt&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see in the screen capture below I did take the content of the field POSTCODE to populate the field POSTCODE_SHORT with only the first part of the postal code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using &lt;STRONG&gt;Calculate Field&lt;/STRONG&gt;, the very pythonic syntax to accomplish this is:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;''.join(!POSTCODE!.split())[:-3]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in your case that would be:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;''.join(!Match_addr!.split())[:-3]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please refer to this discussion for additional explanation: &lt;A class="link-titled" href="https://stackoverflow.com/questions/1798465/python-remove-last-3-characters-of-a-string" title="https://stackoverflow.com/questions/1798465/python-remove-last-3-characters-of-a-string"&gt;Python Remove last 3 characters of a string - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Egge-Jan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/452648_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jul 2019 14:50:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-last-3-characters-using-field-calculator/m-p/306111#M23744</guid>
      <dc:creator>Egge-Jan_Pollé</dc:creator>
      <dc:date>2019-07-09T14:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting last 3 characters using field calculator in ArcGIS Pro (UK Postcode)</title>
      <link>https://community.esri.com/t5/python-questions/deleting-last-3-characters-using-field-calculator/m-p/306112#M23745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your speedy response Egge-Jan, worked like a charm! Thank you &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jul 2019 15:11:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-last-3-characters-using-field-calculator/m-p/306112#M23745</guid>
      <dc:creator>e_cat</dc:creator>
      <dc:date>2019-07-09T15:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting last 3 characters using field calculator in ArcGIS Pro (UK Postcode)</title>
      <link>https://community.esri.com/t5/python-questions/deleting-last-3-characters-using-field-calculator/m-p/306113#M23746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/347248"&gt;Emily Catt&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sounds like your issue has been solved, doesn't it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you please be so kind to mark your question as being answered? This will help the community in finding correct information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Egge-Jan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jul 2019 15:25:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-last-3-characters-using-field-calculator/m-p/306113#M23746</guid>
      <dc:creator>Egge-Jan_Pollé</dc:creator>
      <dc:date>2019-07-09T15:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting last 3 characters using field calculator in ArcGIS Pro (UK Postcode)</title>
      <link>https://community.esri.com/t5/python-questions/deleting-last-3-characters-using-field-calculator/m-p/306114#M23747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/3420"&gt;Joshua Bixby&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Joshua Bixby markeerde het antwoord van Emily Catt als juist&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Why did you mark the "Thank you" as the correct answer, and not the actual answer I gave to the question?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just curious &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Egge-Jan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jul 2019 21:13:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-last-3-characters-using-field-calculator/m-p/306114#M23747</guid>
      <dc:creator>Egge-Jan_Pollé</dc:creator>
      <dc:date>2019-07-09T21:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting last 3 characters using field calculator in ArcGIS Pro (UK Postcode)</title>
      <link>https://community.esri.com/t5/python-questions/deleting-last-3-characters-using-field-calculator/m-p/306115#M23748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry about that, clicked on the wrong link.&amp;nbsp; I just updated it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jul 2019 22:26:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-last-3-characters-using-field-calculator/m-p/306115#M23748</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-07-09T22:26:31Z</dc:date>
    </item>
  </channel>
</rss>

