list.append(object)
實例:html
#!/usr/bin/python3 a = ['abc', '2019_11', 'pople'] bac = ['aYuYa'] others = {'name': 'jack'} tuples = ('yxs', 100) a.append('python') a.append(bac) a.append(tuples) a.append(others) print("New list: " + str(a))
輸出:python
New list: ['abc', '2019_11', 'pople', 'python', ['aYuYa'], ('yxs', 100), {'name': 'jack'}]