import reprint(re.sub("{[^{}]+}", lambda m: m.group()[1:-1], "foo{}bar{baz}"))
Standard input is empty
foo{}barbaz
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!