About 50 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. string - Python Replace \\ with \ - Stack Overflow

    Mar 3, 2015 · In Python string literals, backslash is an escape character. This is also true when the interactive prompt shows you the value of a string. It will give you the literal code representation of …

  3. python - Changing a character in a string - Stack Overflow

    Aug 4, 2009 · Strings are immutable in Python, which means you cannot change the existing string. But if you want to change any character in it, you could create a new string out it as follows,

  4. python - Replacing instances of a character in a string - Stack Overflow

    Oct 4, 2012 · 348 Strings in python are immutable, so you cannot treat them as a list and assign to indices. Use .replace() instead:

  5. python - How do you replace all the occurrences of a certain character ...

    The problem is that you are not doing anything with the result of replace. In Python strings are immutable so anything that manipulates a string returns a new string instead of modifying the original …

  6. Replacing a substring of a string with Python - Stack Overflow

    The curly-bracket style is only supported in Python 2.6 or later. It is the most flexible style (providing a rich set of control characters and allowing objects to implement custom formatters).

  7. Python string.replace regular expression - Stack Overflow

    I want to replace one parameter's parameter-value with a new value. I am using a line replace function posted previously to replace the line which uses Python's string.replace(pattern, sub). The regular …

  8. python - Best way to replace multiple characters in a string? - Stack ...

    Mar 19, 2019 · Replacing two characters I timed all the methods in the current answers along with one extra. With an input string of abc&def#ghi and replacing & -> \& and # -> \#, the fastest way was to …

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

    def replace_all(text, dic): for i, j in dic.iteritems(): text = text.replace(i, j) return text where text is the complete string and dic is a dictionary — each definition is a string that will replace a match to the …

  10. How to replace text in a string column of a Pandas dataframe?

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