About 632,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 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 …

  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. python - Best way to replace multiple characters in a string? - Stack ...

    Mar 19, 2019 · If you're more interested in funcionality over time optimization, do not use replace. Also use translate if you don't know if the set of characters to be replaced overlaps the set of characters …

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

  6. How to use .replace in python? - Stack Overflow

    Sep 13, 2013 · string.replace (s, old, new [, maxreplace]) Return a copy of string s with all occurrences of substring old replaced by new. If the optional argument maxreplace is given, the first maxreplace …

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

  8. python - How can I use a dictionary to do multiple search-and-replace ...

    Dec 21, 2022 · 7 I would suggest to use a regular expression instead of a simple replace. With a replace you have the risk that subparts of words are replaced which is maybe not what you want.

  9. How to use python-docx to replace text in a Word document and save

    Python is the only language I know (beginner+, maybe intermediate), so please do not assume any knowledge of C, Unix, xml, etc. Task : Open a ms-word 2007+ document with a single line of text in it …

  10. Remove all line breaks from a long string of text - Stack Overflow

    Basically, I'm asking the user to input a string of text into the console, but the string is very long and includes many line breaks. How would I take the user's string and delete all line breaks to