Mega Code Archive

 
Categories / Python Tutorial / List
 

Modifying a list

x = [1, 2, 3, 4] x[1] = 42                # x is now [1, 42, 3, 4] print x