I have a line:
res = 'qwer!@ 234234 4234gdf36/\////// // \ \\\$%^$% dsfg'
and I want to remove ALL traits and backslashes. I tried this:
import string
import re
symbolsToRemove = string.punctuation
res = 'qwer!@ 234234 4234gdf36/\////// // \ \\\$%^$% dsfg'
res = re.sub(r'['+symbolsToRemove+']', ' ', res)
print(res)
But we get the following result:
qwer 234234 4234gdf36 \\\ dsfg
What am I doing wrong?
source
share