How to split a string in python based on dots, ignoring decimal values?
<p>I have the following string:</p>

<blockquote>
  <p>s = 'This .is sparta 1.2 version. Please check.'</p>
</blockquote>

<p>I want to split it based on dots, while ignoring decimal figures.
So, Required Output :</p>

<blockquote>
  <p>['This ','is sparta 1.2 version','Please check']</p>
</blockquote>

<p>I tried following:</p>

<pre><code>    re.split(r'\.(?!([\d+\.\d+]))',s)
</code></pre>

<p>The output I am getting is:</p>

<blockquote>
  <p>['This ', None, 'is sparta 1.2 version', '', ' Please check', None, '']</p>
</blockquote>

<p>Why am I getting None and empty strings here? I just want the split strings, ie.</p>

<blockquote>
  <p>['This ','is sparta 1.2 version','Please check']</p>
</blockquote>

<p>Please suggest the rectification here.</p>

<p>Since almost have what you want, you could parse the current output to remove Nones and empty strings.</p>

<p>This can be done in one line using list comprehension:</p>

<pre><code>FilteredList = [ itm for itm in UnfilteredList if itm is not None and len(itm)&gt;0]
</code></pre>

python regex