Could anyone help me with the following scenario?
NFL season is approaching and I am working on a python script to scrape spreads off a website for analysis.
scenario one: spread comes in the form -3+3
scenario two: spread comes in the form -3.5+3.5
import re
s1 = '-3+3'
s2 = '-3.5+3.5'
search1 = re.search(r'(.\d)(.*)',s1)
search2 = re.search(r'(.\d)(.*)',s2)
print search1.group(1),','search1.group(2)
print search2.group(1),',',search2.group(2)
>-3 , +3
>-3 , .5+3.5
As you can see the output of the second scenario chops off anything after the decimal place and places it in front of the next number. Can anyone help me find a solution that would be applicable to both situations?
Thanks!
([-+]?\d+(?:\.\d+)?)([-+]?\d+(?:\.\d+)?)try that.