Reputation: 13
I have a string similar to this "A["B"]C" I need this string to look like "A[B]C"
. Do you know how to do it?
Upvotes: 1
Views: 2105
Reputation: 3751
You can use re.sub for this.
import re
string = "[6->['A', 'B']; 7->['ABC']]"
string = re.sub("'","",string)
That will remove all ' characters from the string.
To get rid of " as well:
string = re.sub("['\"]","",string)
Upvotes: 1