# append和extend区别 def append_extend(): ''' 记住一点:append是追加,extend是对列表的扩展 :return: ''' list1 = [1,2] list1.append([3,4]) print list1 # [1, 2, [3, 4]] list1.extend([5,6]) # [1, 2, [3, 4], 5, 6] print list1 list1.append('love') # [1, 2, [3, 4], 5, 6, 'love'] print list1 list1.extend('python') # [1, 2, [3, 4], 5, 6, 'love', 'p', 'y', 't', 'h', 'o', 'n'] print list1