<?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: Strip numbers from certain fields in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454638#M35728</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am receiving this data and in order for me to make it work for me i have to clean this table up but i get what you are saying.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 31 Oct 2018 21:54:44 GMT</pubDate>
    <dc:creator>TonyAlmeida</dc:creator>
    <dc:date>2018-10-31T21:54:44Z</dc:date>
    <item>
      <title>Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454622#M35712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to strip numbers from certain fields. I have the following but it strips all number from the entire table.&lt;/P&gt;&lt;P&gt;Some of these fields have blanks and nulls.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy

arcpy.env.overwriteOutput = True

table = "C:/temp/EMS_Table"

field = ['Agency', 'fa', 'lz']
for field in [f.name for f in arcpy.Describe(table).fields if f.type == "String"]:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; exp = "!{0}!.strip('0123456789.- ')"&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.CalculateField(table, field, exp.format(field), "PYTHON")‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:16:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454622#M35712</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2021-12-11T20:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454623#M35713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are overwriting the list of fields when you create the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;field &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Agency'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'fa'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'lz'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; field &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;4&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;field&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;
&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;
&lt;SPAN class="number token"&gt;4&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you know the fields you want to loop through:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;fields &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Agency'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'fa'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'lz'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; field &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fields&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;field&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

Agency
fa
lz&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:16:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454623#M35713</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-11T20:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454624#M35714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;field gets defined twice, once in line 7 … which are the fields that you want I presume.... but it gets redefined again in line 8 in the 'for field....' section.&amp;nbsp; I suspect that it is not just doing the fields you want but all the fields that are of type 'String'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 18:44:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454624#M35714</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-10-30T18:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454625#M35715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you show what the field values look like at present?&amp;nbsp; Is there a pattern of how they are formatted like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FA25 or FA 25 ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you follow some sort of naming convention in your field values it's always easier to parse them out when you need to...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 18:49:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454625#M35715</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2018-10-30T18:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454626#M35716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes it's doing all the fields, not really sure how to write it. I am also not sure if this is the best way. would using with arcpy.da.UpdateCursor better?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 19:08:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454626#M35716</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2018-10-30T19:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454627#M35717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think for the most part they are just FA25 with no spaces.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 19:08:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454627#M35717</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2018-10-30T19:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454628#M35718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think there is some confusion about whether you are trying to strip stuff from values in a field, or strip the fields (which are weirdly names, hence the suspicion) that you have listed.&lt;/P&gt;&lt;P&gt;If we assume your fields are as listed in line 1 and assuming you are working on a copy and that your calculatefield expression actually works... maybe&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;field = ['Agency', 'fa', 'lz']
for f in field:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exp = "!{0}!.strip('0123456789.- ')"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.CalculateField(table, f, exp.format(field), "PYTHON")‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now if those aren't the fields, maybe you might want to show with a screen grab what you are working with&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:16:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454628#M35718</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T20:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454629#M35719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to strip from the number values in those fields. sorry for not making it clear.&lt;/P&gt;&lt;P&gt;i am getting ERROR 000539: Invalid field&lt;CODE&gt;['Agency', 'fa', 'lz']&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/426746_EMSTable.png" /&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 21:25:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454629#M35719</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2018-10-30T21:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454630#M35720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; font-size: 14px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;arcpy.management.CalculateField(table, f, exp.format(f), "PYTHON")&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2018 21:37:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454630#M35720</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2018-10-30T21:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454631#M35721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I stole this from StackOverflow:&amp;nbsp;&amp;nbsp;&lt;A class="link-titled" href="https://stackoverflow.com/questions/12851791/removing-numbers-from-string" title="https://stackoverflow.com/questions/12851791/removing-numbers-from-string" rel="nofollow noopener noreferrer" target="_blank"&gt;python - Removing numbers from string - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;no_digits &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# Iterate through the string, adding non-numbers to the no_digits list&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; s&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; i&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;isdigit&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; no_digits&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Now join all elements of the list with '', &lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# which puts all of the characters together.&lt;/SPAN&gt;
result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;no_digits&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Where s = your field value....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edited- just to add, you could do the inverse, and look for and keep letters....&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;is_alpha &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; s&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; i&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;isalpha&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; is_alpha&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:16:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454631#M35721</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-11T20:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454632#M35722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;from this old thread&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="link-titled" href="https://community.esri.com/thread/184106-how-to-split-variable-length-field-at-first-number-field-calculator?commentID=639336#comment" title="https://community.esri.com/message/639336-re-how-to-split-variable-length-field-at-first-number-field-calculator?commentID=639336#comment-639336" target="_blank"&gt;https://community.esri.com/message/639336-re-how-to-split-variable-length-field-at-first-number-field-calculator?comment…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;keep numbers&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;fld &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"aaasdfasdfasdf12341asdfadfadsf"&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;i &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fld &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; i&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;isdigit&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;or&lt;/SPAN&gt; i &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;strip&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;'12341'&lt;/SPAN&gt;‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;keep text&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;i &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; fld &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; i&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;isalpha&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;or&lt;/SPAN&gt; i &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;strip&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;'aaasdfasdfasdfasdfadfadsf'&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;line 1 becomes your field calculation and you feed 'fld' into it&lt;/P&gt;&lt;P&gt;ie&lt;/P&gt;&lt;P&gt;for fld in fields:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; do stuff with the above in your code&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:16:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454632#M35722</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T20:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454633#M35723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I grab suggestions from StackOverflow quite a bit, I try to include a link to the original SO thread to include in my GeoNet comment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2018 13:01:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454633#M35723</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-10-31T13:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454634#M35724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see edit above....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2018 14:53:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454634#M35724</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2018-10-31T14:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454635#M35725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After running everything looked fine but there seems to be some "#" symbols in those fields as well, For example Uk05#26. I need to remove those as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field = ['Agency', 'fa', 'lz']&lt;BR /&gt;for f in field:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exp = "!{0}!.strip('0123456789.- ')"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.CalculateField(table, f, exp.format(f), "PYTHON")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2018 19:43:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454635#M35725</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2018-10-31T19:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454636#M35726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's thing about naming conventions: they don't mean anything if people won't/don't follow them. Once you get your data cleaned up, then automation works really, really well. You can make yourself crazy trying to automate anomalies only to find another one.&amp;nbsp; And then another.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sometimes you just have to roll up your sleeves and expect to get your hands dirty...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2018 19:57:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454636#M35726</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2018-10-31T19:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454637#M35727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;just add # to your strip( '0123456789.- #') list&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2018 21:27:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454637#M35727</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-10-31T21:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454638#M35728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am receiving this data and in order for me to make it work for me i have to clean this table up but i get what you are saying.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2018 21:54:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454638#M35728</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2018-10-31T21:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454639#M35729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did try that before i posted but for some reason it's only removing the # from two fields not all three. I just wasn't sure if i was missing something. Does it matter if there is spaces? for example "UK 05# 56CCO. So in this example it needs to be UKCCO.That's the only thing i am seeing that is different.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2018 22:00:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454639#M35729</guid>
      <dc:creator>TonyAlmeida</dc:creator>
      <dc:date>2018-10-31T22:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454640#M35730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I like summary tables to find the outliers. A pound sign or dash&amp;nbsp;or some other weird character will jump out in a hurry, and typically the count will be fairly low...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2018 22:00:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454640#M35730</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2018-10-31T22:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Strip numbers from certain fields</title>
      <link>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454641#M35731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you look at your replace list, make sure there is a space in it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;a = '0123456789.- #'&lt;/DIV&gt;&lt;DIV&gt;a0 = list(a)&lt;/DIV&gt;&lt;DIV&gt;a0&lt;BR /&gt;['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '-', ' ', '#'] &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Notice the character before # is a space '&amp;nbsp; '&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2018 23:19:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strip-numbers-from-certain-fields/m-p/454641#M35731</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-10-31T23:19:43Z</dc:date>
    </item>
  </channel>
</rss>

