import reprint(re.split('(\W*)', 'a---b'))
Standard input is empty
['', '', 'a', '---', '', '', 'b', '', '']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!