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

    Feb 26, 2012 · Official doc for str.replace of Python 3 official doc: Python 3's str.replace str.replace (old, new [, count]) Return a copy of the string with all occurrences of substring old replaced by new. If the …

  2. A list of string replacements in Python - Stack Overflow

    Apr 19, 2009 · A list of string replacements in Python Asked 16 years, 10 months ago Modified 5 years, 7 months ago Viewed 85k times

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

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

    Careful: Python dictionaries don't have a reliable order for iteration. This solution only solves your problem if: order of replacements is irrelevant it's ok for a replacement to change the results of …

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

    This is what I ended up doing to replace, but I get the "A value is trying to be set on a copy of a slice from a DataFrame." warning. The resulting dataframe is exactly what I want, but the warning is off …

  6. python - How does str.replace work? - Stack Overflow

    Jul 17, 2014 · 4 Because strings are immutable, str.replace(x, " ") does not modify the string object referenced by str in any way. Instead, it returns a copy of this object were x is replaced with " ". In …

  7. regex - Use Python's string.replace vs re.sub - Stack Overflow

    Apr 14, 2011 · For Python 2.5, 2.6, should I be using string.replace or re.sub for basic text replacements? In PHP, this was explicitly stated but I can't find a similar note for Python.

  8. python - How to input a regex in string.replace? - Stack Overflow

    17 replace method of string objects does not accept regular expressions but only fixed strings (see documentation: http://docs.python.org/2/library/stdtypes.html#str.replace). You have to use re module:

  9. 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? …

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

    Format is really powerful. You can use it to decide how wide to make a field, how to write numbers, and other formatting of the sort, depending on what you write inside the brackets. You could also use the …