import reL1=['alpha(1) beta(4)','delta(5) gamma(6)']res = [filter(None, re.split(r'\(\d+\)\s*', item)) for item in L1]print(res)
Standard input is empty
[['alpha', 'beta'], ['delta', 'gamma']]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!