Python Change List Item


Change Item Value

To change the value of a specific item, refer to the index number:

Example

Change the second item:

thislist = ["apple", "banana", "cherry"]
thislist[1] = "blackcurrant"
print(thislist)
Try it Yourself »


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.