What's a pythonic way to parse this string in the brackets:
txt = 'foo[bar]'
to get as result:
bar
What have I tried:
How I would solve it and I believe it's not very elegant:
result = txt.split('[')[1].split(']')[0]
I strongly think there is a library or method out there that has a more fault-tolerant and elegant solution for this. That's why I created this question.