title: Python function which split string by ',' and ignore ':'
body: <p>I need to write a function using regular expressions, <code>func(string)</code>, which returns the resulting list as a result of splitting the string. The separators can be enclosed commas with optional spaces or single colons. Look on 'spaces' in example with <code>:</code> and <code>,</code>. I don't know how to achieve this effect.</p>
  <p>Result which I will expect:</p>
  <pre class="lang-py prettyprint-override"><code>&gt;&gt;&gt; func(&quot;foo, bar   , sss:s&quot;)
  ['foo', 'bar', 'sss', 's'] 
  &gt;&gt;&gt; func(&quot;foo&quot;),
  ['foo']        
  &gt;&gt;&gt; func(&quot;bla  : bla&quot;),
  'bla  ', ' bla'
  </code></pre>
  <p>I have this for now:</p>
  <pre class="lang-py prettyprint-override"><code>import re
  
  def func(t):
      match = re.split(r'[,:]', t)
      return match
  </code></pre>