<?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 Remove Alph and special characters from string filed in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30188#M2381</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a table with a field called group_code and in this field there strings like the following.&lt;/P&gt;&lt;P&gt;2,10,12,15H, 26P, 35$#. As you can see some have a alph and special characters and some don't. So i don't think i can use the cursor.updateRow([row[0][1:-1]]).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to remove all the Alph and special characters at the end of each column for the group_code field.&lt;/P&gt;&lt;P&gt;I have tried the following but no luck. I need this to be outside the field calculator.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;table &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Temp\Default.gdb\LandVal"&lt;/SPAN&gt;fieldValue &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"group_code"&lt;/SPAN&gt;&amp;nbsp; 
&lt;SPAN class="comment token"&gt;#Removes alpha at the end&amp;nbsp; for field in arcpy.ListFields(table, "group_code", "String"):&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exp &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;&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; fieldValue &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="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; 
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CalculateField&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;table&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; field&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; exp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;field&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"PYTHON"&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;&amp;nbsp; 
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;conversion&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;TableToTable&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;table&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Temp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"LandVal_Test.dbf"&lt;/SPAN&gt;&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 21:12:31 GMT</pubDate>
    <dc:creator>2Quiker</dc:creator>
    <dc:date>2021-12-10T21:12:31Z</dc:date>
    <item>
      <title>Remove Alph and special characters from string filed</title>
      <link>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30188#M2381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a table with a field called group_code and in this field there strings like the following.&lt;/P&gt;&lt;P&gt;2,10,12,15H, 26P, 35$#. As you can see some have a alph and special characters and some don't. So i don't think i can use the cursor.updateRow([row[0][1:-1]]).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to remove all the Alph and special characters at the end of each column for the group_code field.&lt;/P&gt;&lt;P&gt;I have tried the following but no luck. I need this to be outside the field calculator.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;table &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Temp\Default.gdb\LandVal"&lt;/SPAN&gt;fieldValue &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"group_code"&lt;/SPAN&gt;&amp;nbsp; 
&lt;SPAN class="comment token"&gt;#Removes alpha at the end&amp;nbsp; for field in arcpy.ListFields(table, "group_code", "String"):&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exp &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;&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; fieldValue &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="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; 
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CalculateField&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;table&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; field&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; exp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;field&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"PYTHON"&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;&amp;nbsp; 
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;conversion&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;TableToTable&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;table&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Temp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"LandVal_Test.dbf"&lt;/SPAN&gt;&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:12:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30188#M2381</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2021-12-10T21:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Alph and special characters from string filed</title>
      <link>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30189#M2382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try without the square brackets, something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; string &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; "&lt;SPAN class="number token"&gt;35&lt;/SPAN&gt;$&lt;SPAN class="comment token"&gt;#"&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;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;c &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; c &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; string &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; c &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'0123456789'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;'35'&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;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;c &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; c &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; string &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; c&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;
&lt;SPAN class="string token"&gt;'35'&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:12:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30189#M2382</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-10T21:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Alph and special characters from string filed</title>
      <link>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30190#M2383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;many ways, the only difference between your line 4 and my line 2, is when the join gets done, it is sometimes just a matter of preference.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;c &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; "&lt;SPAN class="number token"&gt;35&lt;/SPAN&gt;$&lt;SPAN class="comment 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;&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; c &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="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;"35"&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:12:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30190#M2383</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-10T21:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Alph and special characters from string filed</title>
      <link>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30191#M2384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe i didn't explain what i am needing correctly.&lt;/P&gt;&lt;P&gt;working table looks like the following.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;THEAD&gt;&lt;TR&gt;&lt;TH style="background-color: #efefef;"&gt;OID&lt;/TH&gt;&lt;TH style="background-color: #efefef;"&gt;group_code&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;35$#&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;26P&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From what i understand is that c = "35$#' is the character to be checked. i don't just need it to check 35$# i need it to check the whole group_code field and remove the the Alph &amp;amp; Special Characters from all of the attributes in the "group_code" field.&lt;/P&gt;&lt;P&gt;Like the following..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;THEAD&gt;&lt;TR&gt;&lt;TH style="background-color: #efefef;"&gt;OID&lt;/TH&gt;&lt;TH style="background-color: #efefef;"&gt;group_code&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;26&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or maybe i am not understand how to incorporate what you two suggested in to my current script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Aug 2016 21:03:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30191#M2384</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2016-08-31T21:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Alph and special characters from string filed</title>
      <link>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30192#M2385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/calculate-field.htm" title="http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/calculate-field.htm"&gt;Calculate Field—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check the syntax and use Python_9.3&lt;/P&gt;&lt;P&gt;what did it print? (through in some print statements prior to calculate field)&lt;/P&gt;&lt;P&gt;did you just try to put the field name in explicitly &amp;nbsp;as the expression ? &amp;nbsp;ie&lt;/P&gt;&lt;P&gt;''.join([i for i in !FieldName! if i.isdigit()])&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Aug 2016 21:20:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30192#M2385</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-08-31T21:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Alph and special characters from string filed</title>
      <link>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30193#M2386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what i am working with .&lt;/P&gt;&lt;P&gt;#Removes alpha at the end &amp;nbsp;&lt;/P&gt;&lt;P&gt;import string, arcpy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table = r"C:\Temp\Default.gdb\LV"&lt;BR /&gt;for field in arcpy.ListFields(table, "group_code", "String"):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; c = "group_code"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exp = ''.join([i for i in c if i.isdigit()]) #''.join([i for i in c if i.isdigit()]) &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(table, "group_code", exp.format(field), "PYTHON_9.3")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting error .&lt;/P&gt;&lt;P&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;BR /&gt;ERROR 000735: Expression: Value is required&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Aug 2016 21:46:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30193#M2386</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2016-08-31T21:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Alph and special characters from string filed</title>
      <link>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30194#M2387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;python uses ! marks around the field... don't have arc* here so try !group_code! in place of c... c doesn't need to be a variable In fact give it whirl in the field calculator. &amp;nbsp;Whatever works there will work in the calculatefield expression... that is how you test them&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Aug 2016 22:22:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30194#M2387</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-08-31T22:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Alph and special characters from string filed</title>
      <link>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30195#M2388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried the following, which seemed to work.&amp;nbsp; This is outside ArcMap, but calls the CalculateField tool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
table &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Temp\Default.gdb\LV"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CalculateField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;table&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"group_code"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"''.join(i for i in !group_code! if i.isdigit())"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"PYTHON_9.3"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;"&lt;SPAN class="comment 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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:12:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30195#M2388</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-10T21:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Alph and special characters from string filed</title>
      <link>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30196#M2389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;glad you tested it Randy...&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Aug 2016 22:30:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30196#M2389</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-08-31T22:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Alph and special characters from string filed</title>
      <link>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30197#M2390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It can also be written:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy
table = r"C:\Temp\Default.gdb\LV"
field = "group_code"
exp =&amp;nbsp; "''.join(i for i in !group_code! if i.isdigit())"
arcpy.CalculateField_management(table,field,exp,"PYTHON_9.3")
&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:12:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30197#M2390</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-10T21:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Remove Alph and special characters from string filed</title>
      <link>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30198#M2391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cursors can replace the CalculateField call to make it a bit clearer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;with arcpy.da.UpdateCursor(file, ['group_code']) as cursor:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;for row in cursor:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;s = row[0]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;row[0] = "".join([c for c in s if c.isnumeric()])&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cursor&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;updateRow&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;row&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;edit: forgot the updateRow call &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2016 22:41:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-alph-and-special-characters-from-string/m-p/30198#M2391</guid>
      <dc:creator>ClintonDow1</dc:creator>
      <dc:date>2016-09-01T22:41:30Z</dc:date>
    </item>
  </channel>
</rss>

