Home  >  Article  >  Backend Development  >  What is append in python

What is append in python

藏色散人
藏色散人Original
2019-06-27 11:19:5449102browse

What is append in python

What is append in python?

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

append() method syntax:

list.append(obj)

Parameters

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

Return value

This method has no return value, but it will modify the original list.

Example

The following example shows how to use the append() function:

#!/usr/bin/python
aList = [123, 'xyz', 'zara', 'abc'];
aList.append( 2009 );
print "Updated List : ", aList;

The output results of the above example are as follows:

Updated List :  [123, 'xyz', 'zara', 'abc', 2009]

Related recommendations: "Python Tutorial

The above is the detailed content of What is append in python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What does python3 mean?Next article:What does python3 mean?