About 11,800,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/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 …

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

  9. python - How to replace tabs in a string? - Stack Overflow

    Mar 19, 2015 · I need to replace tabs in a string, but only the tabs, not the spaces. If I use the str.replace() function, what would go in the first set of quotes?

  10. python - How to replace NaN values in a dataframe column - Stack …

    On the other hand, replace() (another method given on this page) is a numpy.putmask operation (source). Because numexpr is a faster than numpy for large arrays, for very large dataframes, …