About 6,330,000 results
Open links in new tab
  1. How to use string.replace() in python 3.x - Stack Overflow

    Feb 26, 2012 · The string.replace() is deprecated on python 3.x. What is the new way of doing this?

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

    After some benchmarking on using replace several times vs regex replacement on a string of increasing length by power of 2 with 100 replacements added, it seems that on my computer …

  3. python .replace () regex - Stack Overflow

    118 In order to replace text using regular expression use the re.sub function: sub (pattern, repl, string [, count, flags]) It will replace non-everlaping instances of pattern by the text passed as …

  4. string - Python Replace \\ with \ - Stack Overflow

    Mar 3, 2015 · Python Replace \\ with \ [duplicate] Asked 14 years, 8 months ago Modified 3 years, 5 months ago Viewed 200k times

  5. python - How to replace text in a string column of a Pandas …

    If you only need to replace characters in one specific column, somehow regex=True and in place=True all failed, I think this way will work: data["column_name"] = …

  6. python - How to replace/overwrite file contents instead of …

    When you say "replace the old content that's in the file with the new content", you need to read in and transform the current contents data = file.read(). You don't mean "blindly overwrite it …

  7. python - How to search and replace text in a file - Stack Overflow

    How do I search and replace text in a file using Python 3? Here is my code: import os import sys import fileinput print ("Text to search for:") textToSearch = input ("> ") pr...

  8. Right-to-left string replace in Python? - Stack Overflow

    May 14, 2020 · I wonder why didn't python teams write a specific method to replace strings from right to left?

  9. python - Replace string within file contents - Stack Overflow

    104 If you'd like to replace the strings in the same file, you probably have to read its contents into a local variable, close it, and re-open it for writing: I am using the with statement in this …

  10. Python dictionary replace values - Stack Overflow

    Jan 20, 2017 · In Python 2, if iterating over a large dictionary, use iteritems() instead of items() so that the entire dictionary contents aren't loaded into memory. (This doesn't matter for Python 3 …