[python][oldboy]list append, extend

# coding=utf8

li = [1, 3, [1, "liu"], "liu"]
print li
li.append([1, 2])
print li
li.extend([1, 2])
print li

 

C:\Python27\python.exe C:/Users/Administrator/PycharmProjects/oldboy/lesson_3/test.py
[1, 3, [1, 'liu'], 'liu']
[1, 3, [1, 'liu'], 'liu', [1, 2]]
[1, 3, [1, 'liu'], 'liu', [1, 2], 1, 2]

Process finished with exit code 0

 

posted @ 2017-08-08 16:00  liuzhipenglove  阅读(138)  评论(0编辑  收藏  举报