Is it possible to do simple math on exiting Python regular expressions?
I have a large file where I need to divide the numbers following ")" by 100. For example, I would convert the following line containing )75 and )2 :
((words:0.23)75:0.55(morewords:0.1)2:0.55);
to )0.75 and )0.02 :
((words:0.23)0.75:0.55(morewords:0.1)0.02:0.55);
My first thought was to use re.sub using the search expression "\)\d+" , but I donโt know how to divide the integer following the parenthesis by 100, or if it is even possible with re .
Any thoughts on how to solve this? Thank you for your help!
chimeric
source share