python regex add space whenever a number is adjacent to a non-number
<p>I am trying to separate non-numbers from numbers in a Python string. Numbers can include floats.</p>

<h2>Examples</h2>

<pre><code>Original String               Desired String
'4x5x6'                       '4 x 5 x 6'
'7.2volt'                     '7.2 volt'
'60BTU'                       '60 BTU'
'20v'                         '20 v'
'4*5'                         '4 * 5'
'24in'                        '24 in'
</code></pre>

<p>Here is a very good thread on how to achieve just that in PHP:</p>

<p><a href="https://stackoverflow.com/questions/11024261/regex-add-space-if-letter-is-adjacent-to-a-number">Regex: Add space if letter is adjacent to a number</a></p>

<p>I would like to manipulate the strings above in Python.</p>

<p>Following piece of code works in the first example, but not in the others:</p>

<pre><code>new_element = []
result = [re.split(r'(\d+)', s) for s in (unit)]
for elements in result:
   for element in elements:
       if element != '':
           new_element.append(element)

    new_element = ' '.join(new_element)
    break
</code></pre>