I am using python regular expression to parse html file, now I need to extract a number from a html tag, the number can be either integer or floating point value. Following are two examples:
integer case:
<span class='addr-bbs'>2 baths</span>
floating point case:
<span class='addr-bbs'>3.5 baths</span>
My original code is:
bath = re.findall('<span class=\"addr_bbs\">' + '(.{1,3})' + 'baths{0,1}<', str(homedata))
But after testing, it misses all the floating point cases. How can I cover both cases to extract the number correctly?
Thanks