title: Rearrange position of words in string conditionally
body: <p>I've spent the last few months developing a program that my company is using to clean and geocode addresses on a large scale (~5,000/day). It is functioning adequately well, however, there are certain address formats that I see daily that are causing issues for me.</p>
  
  <p>Addresses with a format such as this <code>park avenue 1</code> are causing issues with my geocoding. My thought process to tackle this issue is as follows:</p>
  
  <ol>
  <li>Split the address into a list</li>
  <li>Find the index of my delimiter word in the list. The delimiter words are words such as <code>avenue, street, road, etc</code>. I have a list of these delimiters called <code>patterns</code>.</li>
  <li>Check to see if the word immediately following the delimiter is composed of digits with a length of 4 or less. If the number has a length of higher than 4 it is likely to be a zip code, which I do not need. If it's less than 4 it will most likely be the house number.</li>
  <li>If the word meets the criteria that I explained in the previous step, I need to move it to the first position in the list.</li>
  <li>Finally, I will put the list back together into a string.</li>
  </ol>
  
  <p>Here is my initial attempt at putting my thoughts into code:</p>
  
  <pre><code>patterns ['my list of delimiters']
  address = 'park avenue 1'    # this is an example address
  address = address.split(' ')
  for pattern in patterns:
      location = address.index(pattern) + 1
      if address[location].isdigit() and len(address[location]) &lt;= 4:
          # here is where i'm getting a bit confused
          # what would be a good way to go about moving the word to the first position in the list
  address = ' '.join(address)
  </code></pre>
  
  <p>Any help would be appreciated. Thank you folks in advance.</p>