Adding Elements to a List : Append « List « Python Tutorial






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








7.2.Append
7.2.1.The append method is used to append an object to the end of a list
7.2.2.Adding Elements to a List
7.2.3.computed some Fibonacci numbers
7.2.4.Uses a string as the sequence to create a list of characters in the string
7.2.5.Adding and Removing Items in a List