Mega Code Archive

 
Categories / Python Tutorial / List
 

Adding Elements to a List

li = ["a", "b", "c", "z", "example"]       print li  li.append("new")                           print li  li.insert(2, "new")                             print li  li.extend(["two", "elements"])                 print li