<?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: remove the last word in a string in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/remove-the-last-word-in-a-string/m-p/446785#M35058</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;" ".join(var.split()[:-1])&lt;/PRE&gt;&lt;SPAN&gt;Will return the original string, minus the last word.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Aug 2012 20:21:53 GMT</pubDate>
    <dc:creator>BruceNielsen</dc:creator>
    <dc:date>2012-08-16T20:21:53Z</dc:date>
    <item>
      <title>remove the last word in a string</title>
      <link>https://community.esri.com/t5/python-questions/remove-the-last-word-in-a-string/m-p/446783#M35056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How does one remove the last word in a string if the field I am querying has variable character lengths?&amp;nbsp; I.e:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1234 S Man 77025&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;123 Main 00865&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to remove the zip code here but the character counts vary.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2012 17:22:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-the-last-word-in-a-string/m-p/446783#M35056</guid>
      <dc:creator>DanielErklauer</dc:creator>
      <dc:date>2012-08-16T17:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: remove the last word in a string</title>
      <link>https://community.esri.com/t5/python-questions/remove-the-last-word-in-a-string/m-p/446784#M35057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This should do what you want. Where var is your string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var.split(" ")[:-1]&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the portion of the string you are trying to remove is always the same length, you could also use the simpler.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var[:-6]&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2012 17:48:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-the-last-word-in-a-string/m-p/446784#M35057</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-08-16T17:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: remove the last word in a string</title>
      <link>https://community.esri.com/t5/python-questions/remove-the-last-word-in-a-string/m-p/446785#M35058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;" ".join(var.split()[:-1])&lt;/PRE&gt;&lt;SPAN&gt;Will return the original string, minus the last word.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2012 20:21:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-the-last-word-in-a-string/m-p/446785#M35058</guid>
      <dc:creator>BruceNielsen</dc:creator>
      <dc:date>2012-08-16T20:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: remove the last word in a string</title>
      <link>https://community.esri.com/t5/python-questions/remove-the-last-word-in-a-string/m-p/1213028#M65581</link>
      <description>&lt;P&gt;Thank you Bruce. Exactly what I needed.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 17:10:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/remove-the-last-word-in-a-string/m-p/1213028#M65581</guid>
      <dc:creator>ColeSutton11</dc:creator>
      <dc:date>2022-09-15T17:10:04Z</dc:date>
    </item>
  </channel>
</rss>

