In [39]: a=[1,3,5,10,13]
In [40]: sub_list_start = 1
In [41]: sub_list_end = 3
In [42]: a[sub_list_start : sub_list_end+1] = [9,7]
In [43]: a
Out[43]: [1, 9, 7, 13]
Hope that helps
More Related Contents:
- convert string to list [duplicate]
- Unable to use convert strings into integers for a for loop
- Strange result when removing item from a list while iterating over it
- Split a string by a delimiter in python
- Pythonic way to print list items
- Detecting consecutive integers in a list [duplicate]
- Non-alphanumeric list order from os.listdir()
- How do I check if there are duplicates in a flat list?
- Memory errors and list limits?
- Sum of list of lists; returns sum list
- List of tuples to dictionary [duplicate]
- [] and {} vs list() and dict(), which is better?
- How to access List elements
- Group by multiple keys and summarize/average values of a list of dictionaries
- Python: Removing spaces from list objects [duplicate]
- Initializing 2D array in Python
- How do I merge multiple lists into one list? [duplicate]
- How can I format a list to print each element on a separate line in python? [duplicate]
- Group list by values [duplicate]
- Python: filtering lists by indices
- What are dict_keys, dict_items and dict_values?
- Ordered intersection of two lists in Python
- What to consider before subclassing list?
- Creating sublists [duplicate]
- Can’t sort my list because it is NoneType? Simple Python [duplicate]
- How to sort a list of dictionaries by a value of the dictionary in Python?
- Why Python `Memory Error` with list `append()` lots of RAM left
- Python: Random numbers into a list
- How to create a nested dictionary from a list in Python?
- Store functions in list and call them later [duplicate]