About 495,000 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 …

  3. How to Replace a String in Python

    Jan 15, 2025 · Replacing strings in Python is a fundamental skill. You can use the .replace() method for straightforward replacements, while re.sub() allows for more advanced pattern …

  4. python - How to replace multiple substrings of a string ... - Stack ...

    It seems the short answer is: there isn't a better way to do this. Here is a short example that should do the trick with regular expressions: For example: '() and --text--' Sign up to request …

  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 …

  6. Python String replace () Method - PyTutorial

    Oct 18, 2024 · Learn how to use the Python string replace () method to replace parts of a string with new values. Explore examples and practical use cases of replace ().

  7. Mastering the Python `replace` Function: A Comprehensive Guide

    Jan 24, 2025 · The replace function in Python is a built-in method for strings. It searches for a specified substring within a given string and replaces all occurrences (or a specified number of …

  8. Mastering Python Replace: Efficient String Manipulation Techniques

    Jun 14, 2025 · Learn how to use Python's replace() method to substitute strings, including syntax, examples, and common use cases. Discover related string manipulation techniques, such as …

  9. Python String.Replace() – Function in Python for Substring …

    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.

  10. Python String replace () - Programiz

    In this tutorial, we will learn about the Python replace () method with the help of examples.