num = re.findall (r'[-+]?\d*\.*\d+' , str (table))
Hi all I have this regular expression and it is printing the values i want. However, they are separated.
For example:
['7', '336.82', '-3.89', '-0.05', '7', '351.60', '7', '322.86', '7', '340.71']
is what it prints
But i want it to print:
['7,336.82', '-3.89', '-0.05', '7,351.60', '7,322.86', '7,340.71']
Please could someone help?
Thanks in advance.
Looks like you want to capture numbers that are separated by comma. You can use:
r'[-+]?(?:\d+[\d,]*)?\.?\d+'
RegEx Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With