I've been trying for the last few hours to kick out some symbols out of a long string in a single shot but can't find any idea as to how I can remove them. If I go for using .replace()
function it will be an uglier approach as the number of symbols is more than one and the function becomes excessively lengthier to cover them all. Any alternative way to remove them will be highly appreciated.
This is I tried:
exmpstr = "Hi there Sam! Don't you know that Alex (the programmer) created something useful or & easy to control"
print(exmpstr.replace("'","").replace("(","").replace(")","").replace("&",""))
print(exmpstr.replace("['()&]","")) #I know it can't be any valid approach but I tried
What I want to kick out are these symbols '()&
from that string other than the way I tried with .replace()
function.