Mega Code Archive

 
Categories / Python Tutorial / Regular Expressions
 

With re split you can split on any sequence of space characters and commas

import re some_text = 'alpha, beta,,,,gamma delta' print re.split('[, ]+', some_text)