How to write the regular expression to get a floating point number in python. I want to get 55.97. from <td nowrap="nowrap">55.97</td>. So I gave
newsecond_row_data = (re.search('(?<=>)\d+|\d+.\d+',second_row_data[a]))
newsecond_row_data.group(0)
print newsecond_row_data.group(0)
but it gave 55 not 55.97. Plz hlp me
Thank you
The reason your pattern isn’t working is because it sees ’55’, finds a match and stops further search.
Then again, I would advice not to use regex and use an XML processing library to extract text out of HTML tags (see Sudhir’s answer).