Или re.split
:
>>> import re
>>> s="[Guide] Strength (STR) is recommended on Warriors (Warriors -> Berserker)"
>>> result = re.split(r"\s+(?=[^()]*(?:\(|$))", s)
>>> next((i[1:-1] for i in result if i[0]=='(' and i[-1]==')'),'No sub-strings that are surrounded by parenthesis')
'STR'
>>>
Примечание: здесь, если строки не содержат подстрок, заключенных в круглые скобки, он выведет 'No sub-strings that are surrounded by parenthesis'
, если это не нужно, вы можете просто сделать:
>>> next((i[1:-1] for i in result if i[0]=='(' and i[-1]==')'))
Или:
>>> [i[1:-1] for i in result if i[0]=='(' and i[-1]==')'][0]