列表

>>> member = ['tianshi','buding','chun','xia']

>>> member.append('shen')                     #向列表添加元素

>>> member

['tianshi', 'buding', 'chun', 'xia', 'shen']

>>> member.extend(['shui','ai'])              #向列表添加列表

>>> member

['tianshi', 'buding', 'chun', 'xia', 'shen', 'shui', 'ai']

>>> member.insert(0, 'wo')                    #向列表中插入一个元素

>>> member

['wo', 'tianshi', 'buding', 'chun', 'xia', 'shen', 'shui', 'ai']

>>> member[0]                                 #获取单个元素

'wo'

>>> member[1]

'tianshi'

>>> member.remove('shen')                     #从列表删除元素

>>> member

['wo', 'tianshi', 'buding', 'chun', 'xia', 'shui', 'ai']

>>> del member[1]                             #指定删除某个位置元素

>>> member

['wo', 'buding', 'chun', 'xia', 'shui', 'ai']

>>> member[1:3]                               #列表分片

['buding', 'chun']

>>> member[:3]

['wo', 'buding', 'chun']

>>> member[1:]

['buding', 'chun', 'xia', 'shui', 'ai']

>>> member[-2]

'shui'

>>> member.pop()                              #移除最后一个元素

'ai'

>>> member

['wo', 'buding', 'chun', 'xia', 'shui']