Answers for "how to obtain the content of brackets"

1

how to obtain the content of brackets

"""
This will try to split the argument into 2, using the square brackets, then
will split the index one, so, the variable foo just is the content of
any group of characters. like ()[]{}
"""
try:
  foo = arg.split("[")[1].split("]")[0]
except:
# The argument doesn't contain a class.
    pass
Posted by: Guest on September-29-2021

Code answers related to "how to obtain the content of brackets"

Python Answers by Framework

Browse Popular Code Answers by Language