import re
txt = 'me (I) you (You) him (He) her (She)'
words = re.findall('\((.+?)\)', txt)
# words returns: ['I', 'You', 'He', 'She']
with open('filename.txt', 'w') as out:
out.write('\n'.join(words))
# file 'filename.txt' contains now:
I
You
He
She
Run Code Online (Sandbox Code Playgroud)