I am using re module in python to remove occurence of certain string. Below is what I am trying:
>>> import re
>>> t = re.sub(re.compile('ab'), "", 'This is a ab text')
>>> t
'This is a text'
Note that in above instead of replacing 'ab' with '' (nothing) its replacing it with a space. Can someone please suggest whats the issue here ?