Question: what is gsub in python?
Answer: gsub is the normal sub in python - that is, it does multiple replacements by default. The method signature for re.sub is sub(pattern, repl, string, count=0, flags=0) If you want it to do a single replacement you specify count=1 : In [2]: re.