Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

change list item in python

#Change the values "banana" and "cherry" with the 
#values "blackcurrant" and "watermelon":

thislist = ["apple", "banana", "cherry", "orange", "kiwi", "mango"]
thislist[1:3] = ["blackcurrant", "watermelon"]
print(thislist)

#Output :['apple', 'blackcurrant', 'watermelon', 'orange', 'kiwi', 'mango']
 
PREVIOUS NEXT
Tagged: #change #list #item #python
ADD COMMENT
Topic
Name
3+2 =