I have a string in Python with the value 'I take $80 from you and give you $ 100.00 back.'. Notice the difference between the two monetary values here. There is no white space between the '$' symbol and value in '$80' but there is a space between '$' and value in '$ 100'.
And I want to return a list which looks like ['$80', '$100.00'] or ['$80', '$ 100.00']. How can I achieve this using Python? I have tried this code which returns the list ['$80', '$100']:
>>> text = 'I take $80 from you and give you $ 100 back.'
>>> import re
>>> re.findall('\$\s*\d+', text)
['$80', '$ 100']