Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
data =[
'Row: 1',
'Row: 1 Seat: 2',
'Row: 1 2 3 stuff blah Seat: Something else lalala ']
>>> [re.match("^Row: (.*?)(Seat: .*)?$", line).groups() for line in data]
[('1', None), ('1 ', 'Seat: 2'), ('1 2 3 stuff blah ', 'Seat: Something else lalala ')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment