string="file()(function)(hii)out(return)(byee)"
for this string i need output like
file()()()out()()
I have tried this
string="file()(function)(hii)out(return)(byee)"
string1=re.sub("[\(\[].*?[\)\]]", "", string)
string2=re.sub(r" ?\([^)]+\)", "", string)
print(string1)
print(string2)
and got output like
fileout
file()out
my desired output should look like this:
file()()()out()()