About 14,900,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 .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.

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

  5. 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:

  6. python - How to replace whitespaces with underscore? - Stack Overflow

    string.replace(" ", "_") I had this problem a while ago and I wrote code to replace characters in a string. I have to start remembering to check the python documentation because they've got built in functions …

  7. python - rreplace - How to replace the last occurrence of an expression ...

    Is there a quick way in Python to replace strings but, instead of starting from the beginning as replace does, starting from the end? For example: >>> def rreplace (old, new, occurrence) &...

  8. python - How to replace/overwrite file contents instead of appending ...

    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 without needing …

  9. Python string.replace regular expression - Stack Overflow

    I am using a line replace function posted previously to replace the line which uses Python's string.replace(pattern, sub). The regular expression that I'm using works for instance in vim but …

  10. python - Conditional Replace Pandas - Stack Overflow

    May 27, 2017 · python pandas replace conditional-statements series edited Jul 21, 2020 at 8:27 Usama Abdulrehman 1,029 3 13 21