I want to remove certain punctuations from a text. I was able to remove my desired characters but it keep leaving a space instead of the character.
In { ) other news tonight,
a Constitutional { | / !! amendment
I have a text such as above and when I process it it becomes
In other news tonight,
a Constitutional !! amendment
Instead of
In other news tonight,
a Constitutional !! amendment
Below is the code I have
for line in lines:
exclude = set('"#$%&\()*+-/:<=>@[\\]^_`{|}')
line = ''.join(ch for ch in line if ch not in exclude)
How do I remove empty spaces that are being produced?