About 633,000 results
Open links in new tab
  1. Replace Values in a List in Python - GeeksforGeeks

    Jan 12, 2026 · Given a list of elements and a value to replace, the task is to update one or more matching values with a new value. For Example: Input: a = [10, 20, 30, 40, 50] and Replace value 30 …

  2. python - Finding and replacing elements in a list - Stack Overflow

    I have to search through a list and replace all occurrences of one element with another. So far my attempts in code are getting me nowhere, what is the best way to do this? For example, suppose my ...

  3. Python: Replace Item in List (6 Different Ways) - datagy

    Oct 19, 2021 · Learn how to replace an item or items in a Python list, including how to replace at an index, replacing values, replacing multiple values.

  4. Python String replace () Method - W3Schools

    W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

  5. Replace values in list using Python - Stack Overflow

    May 28, 2015 · Replace values in list using Python [duplicate] Ask Question Asked 16 years, 5 months ago Modified 8 years, 2 months ago

  6. python - Substitute elements in a list - Stack Overflow

    Mar 26, 2018 · Dictionaries are great for this kind of thing. Use a list comprehension to iterate through and look up each element in the replacements dictionary, using .get so that it defaults to the current …

  7. Cloning or Copying a List - Python - GeeksforGeeks

    Oct 28, 2025 · Explanation: The [:] operator selects all elements and creates a new list, independent of the original. Using list () This method uses Python’s list () constructor to generate a copy of the …

  8. Replace Strings in Python: replace (), translate (), and Regex

    May 4, 2025 · In Python, you can replace strings using the replace() and translate() methods, or with regular expression functions like re.sub() and re.subn(). Additionally, you can replace substrings at …

  9. Download Python | Python.org

    Jun 22, 2001 · The official home of the Python Programming Language

  10. Replace substring in list of strings - Python - GeeksforGeeks

    Jul 11, 2025 · Let's discuss different methods to do this in Python. Using List Comprehension with replace () replace () method replaces occurrences of a substring in a string. Using list …