<?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: Spaces in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/spaces/m-p/1214840#M65655</link>
    <description>&lt;P&gt;Here are a bunch of examples of how to play with python strings (slice, modify, etc).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.w3schools.com/python/python_strings.asp" target="_blank"&gt;https://www.w3schools.com/python/python_strings.asp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Sep 2022 21:24:12 GMT</pubDate>
    <dc:creator>DeanAnderson2</dc:creator>
    <dc:date>2022-09-21T21:24:12Z</dc:date>
    <item>
      <title>Spaces</title>
      <link>https://community.esri.com/t5/python-questions/spaces/m-p/1214812#M65653</link>
      <description>&lt;P&gt;Supposed I have a string '111 SPEASST' in my table but want to make it&lt;/P&gt;&lt;P&gt;111 S PEAS ST&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the Python Expression I could use in the Calculate Field parser to accomplish this&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 20:24:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/spaces/m-p/1214812#M65653</guid>
      <dc:creator>SLouq</dc:creator>
      <dc:date>2022-09-21T20:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Spaces</title>
      <link>https://community.esri.com/t5/python-questions/spaces/m-p/1214819#M65654</link>
      <description>&lt;P&gt;I assume you're trying to clean up address data, which doesn't have a generic solution. If it's the same error over and over you can use string methods such as .index, .split, .join, slicing etc. to fix the error, here's an example that'll work for your example string:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def fixAddr(x):
  sNum, sData = x.split()
  sDir = sData[0]
  sName = sData[1:-2]
  sType = sData[-2:]
  return f"{sNum} {sDir} {sName} {sType}"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want a generic method, the only technique I can think of is to run your address string through a geocoder and then pull out the component parts from the returned address. This is much more complex than just basic field calculation but it's the most bulletproof method I've found. Good luck!&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 20:41:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/spaces/m-p/1214819#M65654</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2022-09-21T20:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Spaces</title>
      <link>https://community.esri.com/t5/python-questions/spaces/m-p/1214840#M65655</link>
      <description>&lt;P&gt;Here are a bunch of examples of how to play with python strings (slice, modify, etc).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.w3schools.com/python/python_strings.asp" target="_blank"&gt;https://www.w3schools.com/python/python_strings.asp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 21:24:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/spaces/m-p/1214840#M65655</guid>
      <dc:creator>DeanAnderson2</dc:creator>
      <dc:date>2022-09-21T21:24:12Z</dc:date>
    </item>
  </channel>
</rss>

