Replacing Substrings

  • Can replace different parts of a string with something else
  • .replace() in Python and JS
print("Hello Brawler".replace("Brawler", "Mihir"))
Hello Mihir
%%js
console.log("Hello Brawler".replace("Brawler", "Mihir"));
<IPython.core.display.Javascript object>
  • Use Case: Useful for replacing specific parts of text without having to re initiate the whole thing again