I have strings that have optional numbers and letters, such as '01a', 'b' and '02'. These strings have always two parts, numbers on the left, and letters on the right side. I'd like to split these strings to get the numbers and letters separately. How can I define mySplit
in a way to get this result?
>>> map(mySplit, ['01123absd', 'bsdf', '02454'])
[('01123', 'absd'), (None, 'bsdf'), ('02454', None)]