I want to remove the '[' square bracket character from a string. I am using re library. I had no problems with this square bracket ']' but I still having problem with this square bracket '['.
My code:
depth_split = ['[575,0]']
new_string = re.sub(']','',depth_split) #working
newnew_string = re.sub('[','',new_string) #not working
PS: I'm using python.
The output that I have : ['[575,0']
The output that I expeting : ['575,0']
There is no need of using
regexhere since it can be done easily usingstr.replace():But if using
regexis necessary try: