I am using python and facing problem to extract specific elements from string which has tuples consisting of numbers. One thing to note here is tuples of numbers in the strings are not fixed, it can be more or less. The format of string will be same as mentioned below:
'string = [(100, 1), (2500, 2), (5000, 3), (10000, 3).....]'
Desired output:
[100,2500,5000,10000.....]
What I tried:
So far I tried splitting above string to get following output
['string', '=', '(100', '1)', '(2500', '2)', '(5000', '3)', '(10000, '3)']
and after that I was planning to strip unwanted characters like (,'
to get numbers I want but this method has to be hard coded for every tuple and the length of tuples in string is not fixed.