split string python with changing indicator

Viewed 408

lets say I have a string .

a = '!!!!!!a1@@@@@@a2&&&&&&a3::::'

It naturally splits by: a1,a2 and a3 to

['!!!!!!','@@@@@@','&&&&&&','::::']

I want to use the split function, something like:

>>> a.split('a*')

The * indicates that it doesn't matter what character comes after a. Is there an immediate way to do this?

3 Answers
Related