oyster wrote: > in my case, I want to replace all the function name with '', that is > sin(1) -> (1) > sin(pi*(2+4)) -> (pi*(2+4)) > how can I use RE in this situation? thanx
this works if there is no implicit multiplication:
re.sub('\w+\(', '(', 'sin(pi*(2+4))')
this one might be more robust:
re.sub('[a-zA-Z]\w*\s*\(', '(', 'sin(pi*cos(2+4))')
--
http://mail.python.org/mailman/listinfo/python-list
