I am trying to parse a string. Like if this is the string "(A (B (C D) (E F)) (G H))", then I want to parse it like A has children B and G, B has children C and E, and no one else has any children. So, I want the output to be ['A_B_G', 'B_C_E']
I'm doing something like:
lst=[]
str = (A (B (C D) (E F)) (G H))
lst.append(str.split(' '))
And then I'm stuck!
Could somebody give me an idea what to do next?