fork download
  1. import re
  2.  
  3. lines = [
  4. 'Ten Thousand,10000',
  5. 'Ten thousand',
  6. 'helloasdf,x',
  7. 'a,b,,c,',
  8. ',d,e'
  9. ]
  10.  
  11. regex = re.compile('(?:^|,)([^,]*)')
  12. for line in lines:
  13. print(regex.findall(line))
  14.  
Success #stdin #stdout 0.02s 9468KB
stdin
Standard input is empty
stdout
['Ten Thousand', '10000']
['Ten thousand']
['helloasdf', 'x']
['a', 'b', '', 'c', '']
['', 'd', 'e']