List: The Difference Between Extend and Append : List Extend « List « Python






List: The Difference Between Extend and Append

List: The Difference Between Extend and Append
li = ['a', 'b', 'c'] 
li.extend(['d', 'e', 'f'])                         
print li 

print len(li)                                            

print li[-1] 

li = ['a', 'b', 'c'] 
li.append(['d', 'e', 'f'])                        

print li 

print len(li)                                            

print li[-1] 
           
       








Related examples in the same category

1.Append multiple items to a listAppend multiple items to a list
2.Adding Elements to ListsAdding Elements to Lists