Latest web development tutorials

Python3 List append () method

Python3 list Python3 list


description

append () method is used at the end of the list to add new objects.

grammar

append () method syntax:

list.append(obj)

parameter

  • obj - the object added to the end of the list.

return value

This method returns no value, but will modify the original list.

Examples

The following example shows the append () method using the function:

#!/usr/bin/python3

list1 = ['Google', 'w3big', 'Taobao']
list1.append('Baidu')
print ("更新后的列表 : ", list1)

Examples of the above output results are as follows:

更新后的列表 :  ['Google', 'w3big', 'Taobao', 'Baidu']

Python3 list Python3 list