<?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: Removing parts of a string field python calculator in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285734#M59036</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the replies everyone. much appreciated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Aug 2014 20:06:40 GMT</pubDate>
    <dc:creator>StephenNorris</dc:creator>
    <dc:date>2014-08-29T20:06:40Z</dc:date>
    <item>
      <title>Removing parts of a string field python calculator</title>
      <link>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285727#M59029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;whats the syntax for removing a specific number of characters from a string.&lt;/P&gt;&lt;P&gt;for example "name.pdf" I want to remove from the right the ".pdf"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry this is a basic question. my searches aren't finding the answer.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 19:30:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285727#M59029</guid>
      <dc:creator>StephenNorris</dc:creator>
      <dc:date>2014-08-29T19:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Removing parts of a string field python calculator</title>
      <link>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285728#M59030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stephen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the split method.&amp;nbsp; Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_1409341390966807" jivemacro_uid="_1409341390966807"&gt;
&lt;P&gt;txt = "name.pdf"&lt;/P&gt;
&lt;P&gt;txt.split(".")[0]&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will return 'name'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 19:43:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285728#M59030</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2014-08-29T19:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: Removing parts of a string field python calculator</title>
      <link>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285729#M59031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;or a little more cryptic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; txt = "name.pdf"&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; a = txt[:-4]&amp;nbsp; #strip off last 4 characters&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; a&lt;/P&gt;&lt;P&gt;'name'&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the [&amp;nbsp; ] means that text is whats called an iterable, meaning each character can be cycled through&lt;/P&gt;&lt;P&gt;the [:&amp;nbsp;&amp;nbsp; means copy everything from the beginning (note the colon after the [ )&lt;/P&gt;&lt;P&gt;the -4] means everything except the last 4 characters (counting from the right)&lt;/P&gt;&lt;P&gt;hence it all means copy the "txt" variable (name.pdf) except the last 4 characters&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 19:46:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285729#M59031</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-08-29T19:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Removing parts of a string field python calculator</title>
      <link>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285730#M59032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'll try that one too. I actually used a successful search strip and found another answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New';"&gt;!Field_name! .rstrip(".pdf")&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 19:46:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285730#M59032</guid>
      <dc:creator>StephenNorris</dc:creator>
      <dc:date>2014-08-29T19:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Removing parts of a string field python calculator</title>
      <link>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285731#M59033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also I was using the field calculator in arcmap. in case that changes anything&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 19:47:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285731#M59033</guid>
      <dc:creator>StephenNorris</dc:creator>
      <dc:date>2014-08-29T19:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: Removing parts of a string field python calculator</title>
      <link>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285732#M59034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Stephen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it would be easier to to it with Excel using the &lt;A href="http://www.gis-connector.de/en/product/"&gt;GISconnector&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;In Excel, use search/replace or strip the characters with =right(), =left()...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Matthias&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 19:49:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285732#M59034</guid>
      <dc:creator>MatthiasAbele</dc:creator>
      <dc:date>2014-08-29T19:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: Removing parts of a string field python calculator</title>
      <link>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285733#M59035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well whatever Excel can do python can do as well &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;&amp;gt;&amp;gt;&amp;gt; txt = "name.pdf"&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; stripped = txt.rstrip(".pdf")&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; stripped&lt;/P&gt;&lt;P&gt;'name'&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 19:59:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285733#M59035</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-08-29T19:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Removing parts of a string field python calculator</title>
      <link>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285734#M59036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the replies everyone. much appreciated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2014 20:06:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/removing-parts-of-a-string-field-python-calculator/m-p/285734#M59036</guid>
      <dc:creator>StephenNorris</dc:creator>
      <dc:date>2014-08-29T20:06:40Z</dc:date>
    </item>
  </channel>
</rss>

