About 266,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. 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:

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

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

  5. Search and replace a line in a file in Python - Stack Overflow

    Sep 2, 2008 · I want to loop over the contents of a text file and do a search and replace on some lines and write the result back to the file. I could first load the whole file in memory and then …

  6. string - replacing text in a file with Python - Stack Overflow

    I'm new to Python. I want to be able to open a file and replace every instance of certain words with a given replacement via Python. as an example say replace every word 'zero' with '0', …

  7. How to use python-docx to replace text in a Word document and …

    Jul 18, 2014 · If you replace the entire text of a paragraph, that will remove any character-level formatting, like a word or phrase in bold or italic. By the way, the code from @wnnmaw's …

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

  9. python - Replace string within file contents - Stack Overflow

    127 This question already has answers here: Replacing instances of a character in a string (17 answers) How to search and replace text in a file (23 answers) How to read a large file - line …

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