import res = r'aaa (bbb (ccc)) ddd'print( re.sub(r'\(([^()]*)\)', r'{\1}', s) )
Standard input is empty
aaa (bbb {ccc}) ddd
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!