About 16,600,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. How do I replace a character in a string with another character in Python?

    Nov 18, 2012 · Strings in Python are immutable, so you cannot change them in place. Check out the documentation of str.replace: Return a copy of the string with all occurrences of substring old …

  3. python - How to replace text in a string column of a Pandas dataframe ...

    For anyone else arriving here from Google search on how to do a string replacement on all columns (for example, if one has multiple columns like the OP's 'range' column): Pandas has a built in replace …

  4. 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 string.

  5. 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 this method is the …

  6. Replace part of a string in Python? - Stack Overflow

    Apr 6, 2012 · I used regular expressions to get a string from a web page and part of the string may contain something I would like to replace with something else. How would it be possible to do this? …

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

    Mar 3, 2015 · Python Replace \\ with \ [duplicate] Asked 14 years, 9 months ago Modified 3 years, 7 months ago Viewed 201k times

  8. 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 example, which …

  9. How to replace only part of the match with python re.sub

    10 You can do it by excluding the parts from replacing. I mean, you can say to the regex module; "match with this pattern, but replace a piece of it".

  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 since …