List is one of the data types in Python, which is "lists". In Python we can insert, delete, modify, and so on the list type.
##新建list类型>>> ball = ['Volleyball','Basketball','Football','Baseball']##可以直接打印出list内容>>>ball['Volleyball','Basketball','Football','Baseball']##也可以使用下标列出, note that the subscript is starting from 0, and the negative number indicates the forward>>>Ball[0]'Volleyball'>>> ball[1]'Basketball'>>> ball[2]'Football'##使用append函数, append content to the list last>>> Ball.append ('Ping-Pong')>>>ball['Volleyball','Basketball','Football','Baseball','Ping-Pong']##选择位置插入, such as inserting ' badminton ' after ' volleyball '>>> Ball.insert (1,'Badminton')>>>ball['Volleyball','Badminton','Basketball','Football','Baseball','Ping-Pong']##替换list中的某一个元素, such as replacing ' badminton ' with ' bowling '>>> ball[1]='Bowling'>>>ball['Volleyball','Bowling','Basketball','Football','Baseball','Ping-Pong']##使用pop () Delete the element, such as deleting the last ' ping-pong ', deleting ' bowling '>>>Ball.pop ()'Ping-Pong'>>>ball['Volleyball','Bowling','Basketball','Football','Baseball']>>> Ball.pop (1)'Bowling'>>>ball['Volleyball','Basketball','Football','Baseball']##使用len () query the number of elements in list>>>ball['Volleyball','Basketball','Football','Baseball']>>>len (Ball)4
"Python-2.7.12" list type