I'm trying to build a market analysis tool. The raw data input is formatted like this:
20,000 shares for 550 USD each
meaning "20,000 shares of stock at 550 USD per share".
Normally, I would grab the price with the following bit of code:
value = re.findall(re.compile('20,000 shares for (.*) USD each'), data)
However, this approach fails me as the number of shares (in this case, 20 thousand) changes as well as the price value. Is there a better way to extract this data?
I apologize in advance for the improper description of my problem; I'm a bit of a newbie to Python and I'm not sure about what technical terms to use in this scenario. If there is a better way to word my title, please feel free to edit, and thank you in advance!
'([[:digit:],]+) shares for ([[:digit:],.]+) USD each'