Row2 = re.findall(r'\d+(?:,\d+)*(?:\.\d+)?', str (table))
Hi all, this is my regular expression. I'm not sure how to alter it in order to also make it display the values that I have scraped with the + or - sign before the figures. For example, my output is '47.31' but its supposed to be '+47.31'.
Please help, thanks.
You could add [+-]?
at the beginning of your regex to match those characters:
Row2 = re.findall(r'[+-]?\d+(?:,\d+)*(?:\.\d+)?', str (table))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.