For example, I want to change the following string
strr = 'Hello, this is a test to remove whitespace.'
To
'Hello,this is a testto removewhitespace.'
So the whitespace directly after a comma, 't' or 'e' character should be removed. I tried something like:
re.sub(', |t |e ', ' ', strr)
However, this removes the comma, t and e as well. Afterwards, I am trying to split the string on the remaining whitespaces. My first approach was to split like this
re.split(' is |a |test|remove', strr)
However, this removes the delimiters as well, which is not what I want to achieve. So basically, I want to provide a list of characters followed by whitespace, such that the whitespace in that substring is removed.