About 5,940,000 results
Open links in new tab
  1. 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.

  2. How to Replace Values in a List in Python? - GeeksforGeeks

    Jan 4, 2025 · Replacing values in a list in Python can be done by accessing specific indexes and using loops. In this article, we are going to see how to replace the value in a List using Python. …

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

    If you want to mutate a then you should do a[:] = [4 if x==1 else x for x in a] (note the full list slice). Just doing the a = will create a new list a with a different id() (identity) from the original one.

  4. How to Replace Values in a List Using Python? - Python Guides

    Mar 5, 2025 · Learn how to replace values in a list using Python with methods like indexing, list comprehension, and `map()`. This guide includes step-by-step examples.

  5. Python: Replacing/Updating Elements in a List (with Examples)

    Jun 6, 2023 · If you want to update or replace multiple elements in a list based on a condition or a function, you can use list comprehension to create a new list with the updated or replaced …

  6. 7 Efficient Ways to Replace Item in List in Python

    Jul 4, 2021 · To Replace Item In List in Python, we can make use of for loops, indexing, comprehension, map and lambda function, while loops, etc.

  7. Replacing Items in a Python List: A Comprehensive Guide

    Apr 10, 2025 · Replacing items in a Python list is a basic yet essential operation in Python programming. By understanding the fundamental concepts, different usage methods, common …

  8. How to Replace Items in a Python List Like a Pro

    Aug 26, 2024 · Replacing items is an essential skill for anyone working with lists in Python. By understanding list indexing and assignment, you can confidently modify your data structures …

  9. How to replace items in a list in Python

    Nov 24, 2023 · Replacing items in a list using Python. This tutorial will show you how to replace certain values, strings or numbers in a given list. You can use the built-in function replace() for …

  10. How to Replace Items in a List Python

    There are two primary ways to replace items in a list: a. Replace individual elements: Use the index (position) of the element you want to replace. b. Replace multiple elements …

  11. Some results have been removed
Refresh