Vérifiez si la chaîne a des crochets Python

string = "This is a [sentence]"


first = string.find("[")


second = string.find("]")


print(string[first + 1:second])
Jittery Jay