I'm looking to split terms on a delimiter. I'd like to put the number as index
and the name as name
.
My terms:
The Beehive
12. Bar 821
13. Natives Bar
14. Last Call Bar
15. Scarlet Lounge
16. Linden Room
17. Rooftop 25
I'm using this code:
terms = ['The Beehive', '12. Bar 821', '13. Natives Bar', '14. Last Call Bar', '15. Scarlet Lounge', '16. Linden Room', '17. Rooftop 25']
delim = re.match('\d+\. ', terms)
if delim is None:
print(delim)
else:
index = index[:delim.end()]
name = index[delim.end():]
This fails to capture the split. I've tested it by printing the delim and it doesn't match anything.