For the following list:
races=['R1', 'R2', 'R3', 'R4', 'R1', 'R2', 'R1', 'R2', 'R3', 'R4', 'R5']
I would like to divide this into:
list_1=['R1', 'R2', 'R3', 'R4']
list_2=['R1', 'R2']
list_3=['R1', 'R2', 'R3', 'R4', 'R5']
So - in using list comprehension with the idea that as soon as the 'R' numbers start descending, a new list starts. My attempt for list_1 is:
list_1=[i for i in races if int(i.split('R')[1])>int((i-1).split('R')[1])]
This doesn't quite work - plus how to handle list_2 and list_3?