About 39,500 results
Open links in new tab
  1. Python: Replacing/Updating Elements in a List (with Examples)

    Jun 6, 2023 · If you want to update or replace multiple elements in a list in place (without creating a new list) based on a condition or a function, you can use the enumerate() function to loop …

  2. Update List in Python - GeeksforGeeks

    Jan 4, 2025 · In Python Programming, a list is a sequence of a data structure that is mutable. This means that the elements of a list can be modified to add, delete, or update the values. In this …

  3. Pythonic way to update a subset of a list with the same value

    Jan 3, 2021 · Yes, you can perform the similar operation but via using list object on the right. For example: In the above example, k number of elements from the f th index in my_list will be …

  4. Python - Change List Items - W3Schools

    To change the value of items within a specific range, define a list with the new values, and refer to the range of index numbers where you want to insert the new values:

  5. How to update an element in a Python list - LabEx

    To update an existing element in a list, you can simply assign a new value to the element at the desired index. You can insert new elements into a list using the insert () method. This method …

  6. How to 'update' or 'overwrite' a python list - Stack Overflow

    If you are trying to take a value from the same array and trying to update it, you can use the following code. 'ts': [ '5a81625ba0ff65023c729022',

  7. Python - Change List Item - GeeksforGeeks

    Dec 24, 2024 · Modifying elements in a list is a common task, whether we're replacing an item at a specific index, updating multiple items at once, or using conditions to modify certain …

  8. How to Update Elements at Specific Indices in Sub-lists using Python

    Apr 9, 2025 · A step-by-step guide on how to change elements at specific indices in sub-lists with Python list comprehension. Learn to manipulate lists effectively!---This...

  9. list - Replacing a sublist with another sublist in python - Stack Overflow

    I want to replace a sub-list from list a, with another sub-list. Something like this: a=[1,3,5,10,13] Lets say I want to take a sublist like: a_sub=[3,5,10] and replace it with b_sub=[9,7] so the final …

  10. Updating Lists in Python - Online Tutorials Library

    You can update single or multiple list elements using append, insert, extend, remove, and clear to change the list content by adding, updating, or removing elements from the list object.

  11. Some results have been removed
Refresh