i want the string 'abc'
abc="['one']"\n['two']"
to output
one
two
as far as i know:
.strip()
only replaces characters at the beginning and at the ending of the string
.translate()
only takes one variable
.replace()
only works with 1 character.
You can use re
.
import re
abc = re.sub(r"['\[\]]", '', abc)
worked for me.