I have a string which looks as such:
my_str = '15(1)(635)(634)(582)(583)'
How do I get an array of values from the string?
[15,1,635,634,582,583]
>Solution :
This can easily be solved with a simple regex : \d+
import re
my_str = '15(1)(635)(634)(582)(583)'
print([int(i.group()) for i in re.finditer(r'\d+', my_str)])
output:
[15, 1, 635, 634, 582, 583]