I tried to substitute elements in a list
# the raw data
square = ['(', ')', '.', '^', '-']
# the result I want
square = ['[', ']', '.', '^', '-']
with multiple steps using methods of remove
and insert
In [21]: square.remove('(')
In [22]: square.remove(')')
In [23]: square.insert(0, '[')
In [24]: square.insert(1, ']')
In [25]: square
Out[25]: ['[', ']', '.', '^', '-']
How to resolve such a problem in a straigtforward way?