Python List append method with Example – Python Tutorial
7 months ago Lalit Bhagtani 0
In this tutorial, we will learn about python list append method.
append method :
This method is used to add an element ( item ) to the end of the list.
Syntax : < List Object >.append( item )
# create list object and assign it to variable l l = ['a','b','c','d','e'] # call append() method by passing 'f' as an argument l.append('f') # print the list, to check its elements print(l) # another way of appending element in the list (without using append() method) l[len(l):len(l)] = 'g' # print the list, to check its elements print(l)
That’s all for Python List append method. If you liked it, please share your thoughts in comments section and share it with others too.