Reputation: 3831
I have a really long array from where I want to get some data, but the data I'm interested in is between this signs <
and >
I have many of them.
If I wanted them all in a single array, how could I do it?
Upvotes: 0
Views: 96
Reputation: 19368
>>> test_str = "<1>dadad<2>gfdgf<3>"
>>> import re
>>> re.findall(r'(?=<).*?(?<=>)', test_str)
['<1>', '<2>', '<3>']
Note that you have to use lazy match, otherwise output will be ['<1>dadad<2>gfdgf<3>']
Upvotes: 2