Using REGEX to remove all characters between 2 given strings (Python 3) -


lets have string , variable,

string = '(-500)x^3' = 100 

i want replace characters within brackets value of a. such string returned as,

string = '(100)x^3' 

thanks!

try regex:

import re  re.sub(r'\((.*)\)', r'(%s)' %s a,  string) 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -