「Python」list.append和list.extend
2017-08-17 20:09
302 查看
# -*- coding: utf-8 -*- """ Created on Thu Aug 17 19:55:39 2017 @author: Shawn Yuen """ list1 = ['a', 'b', 'c'] print("list1 is ", list1) print("the type of list1 is ", type(list1)) #extend #list2 = ['d', 'e', 'f'] list2 = ['d'] list1.extend(list2) print("the result of extend is ", list1) print("the length of list3 is ", len(list1)) print("the last entry of list1 is ", list1[-1]) #append list3 = ['a', 'b', 'c'] list3.append(list2) print("the result of append is ", list3) print("the length of list3 is ", len(list3)) print("the last entry of list3 is ", list3[-1]) print("the last entry of list1 is equal to that of list3?", list3[-1] is list1[-1])参考资料
相关文章推荐
- Python List中的append和extend
- Python list 之 append 和 extend
- Python 基础——tuple与list、append与extend
- python list成员函数extend与append的区别
- Python List中的append和extend
- python--list中append()与extend()用法
- python中list数据的append 和 extend 用法是区别
- python之list.append()和list.extend(list)的区别
- python学习-python list中append()与extend()用法
- Python list之append和extend的区别
- Python List中的append和extend
- [python] list.append()和list.extend()的区别
- python中的 list (列表)append()方法 与extend()方法的用法 和 区别
- python list之append和extend的区别
- list的extend()与append()的使用和区别 Python
- python list中append()与extend()用法分享
- python list之extend和append的区别
- python list中append()与extend()用法
- Python List 对象的 append 和 extend 的区别
- python list 的 extend 和 append