About 14,700 results
Open links in new tab
  1. Python String replace () Method - W3Schools

    Definition and Usage The replace() method replaces a specified phrase with another specified phrase. Note: All occurrences of the specified phrase will be replaced, if nothing else is specified.

  2. Python String replace () Method - GeeksforGeeks

    Nov 17, 2025 · The replace () method returns a new string where all occurrences of a specified substring are replaced with another substring. It does not modify the original string because Python strings are …

  3. How to use string.replace () in python 3.x - Stack Overflow

    Feb 26, 2012 · To be clear: string.replace () is actually not deprecated on Python 3. Sometimes people write "str.replace" when they mean [your string variable].replace. Because 'str' is also the name of …

  4. How to Replace a String in Python

    In this tutorial, you'll learn how to remove or replace a string or substring. You'll go from the basic string method .replace () all the way up to a multi-layer regex pattern using the sub () function from …

  5. Replace Strings in Python: replace (), translate (), and Regex

    May 4, 2025 · In Python, you can replace strings using the replace() and translate() methods, or with regular expression functions like re.sub() and re.subn(). Additionally, you can replace substrings at …

  6. Python Remove Text from String Methods - PyTutorial

    6 days ago · Learn how to remove text from strings in Python using replace(), translate(), regex, and slicing with clear examples for beginners.

  7. Python String Replace Method - Online Tutorials Library

    Learn how to use the string replace method in Python to substitute substrings with ease. Explore examples and syntax for effective string manipulation.

  8. Mastering `str.replace` in Python: A Comprehensive Guide

    Apr 19, 2025 · One of the most useful functions for modifying strings is str.replace(). Whether you're cleaning up data, transforming text for display, or preparing strings for further processing, str.replace …

  9. Python String replace ()

    In this tutorial of Python Examples, we learned about string replace () method, and how to use this string replace () method to replace the occurrences of a substring with another string, with the help of well …

  10. Python String.Replace() – Function in Python for Substring Substitution

    Jan 24, 2022 · In this article you'll see how to use Python's .replace() method to perform substring substiution. You'll also see how to perform case-insensitive substring substitution. Let's get started! …