Python学习梳理
来源:互联网 发布:网络直播策划方案 编辑:程序博客网 时间:2024/04/28 20:56
列表常用BIF
cast = [“Linux”,”Mac OS”, “Windows”]
print(cast)
[‘Linux’, ‘Mac OS’, ‘Windows’]
print(len(cast))
1. len() 得出列表中有多少项
print(len(cast))
3
print(cast[0])
Linux
2. append() 在列表的末尾增加一数据项
cast.append(“Kylin OS”)
print(cast)
[‘Linux’, ‘Mac OS’, ‘Windows’, ‘Kylin OS’]
3. pop() 删除末尾数据项
cast.pop()
‘Kylin OS’
print(cast)
[‘Linux’, ‘Mac OS’, ‘Windows’]
4. extend() 在末尾增加一个数据项集合
cast.extend([“Kylin OS”, “Galaxy OS”])
print(cast)
[‘Linux’, ‘Mac OS’, ‘Windows’, ‘Kylin OS’, ‘Galaxy OS’]
5. remove() 在列表中找到并删除一个数据项
cast.remove(“Galaxy OS”)
print(cast)
[‘Linux’, ‘Mac OS’, ‘Windows’, ‘Kylin OS’]
6. insert() 在某个特定位置添加一个数据项
cast.insert(1, “Galaxy OS”)
print(cast)
[‘Linux’, ‘Galaxy OS’, ‘Mac OS’, ‘Windows’, ‘Kylin OS’]
- Python学习梳理
- python学习知识体系梳理
- python学习:驳杂知识梳理
- python机器学习入门资料梳理
- python机器学习入门资料梳理
- Python的机器学习库汇总与梳理
- Python的机器学习库汇总与梳理
- Python的机器学习库汇总与梳理
- Python的机器学习库汇总与梳理
- Python 爬虫思路梳理
- python 基本数据类型梳理
- Python代码流程梳理
- Python爬虫知识梳理
- Python知识点总结梳理
- hbase 学习梳理
- hbase 学习梳理
- hbase 学习梳理
- hbase 学习梳理
- CSU 1812 三角形和矩形
- URI和URL的区别
- CSU 1804 有向无环图(图上的dp)
- 【Codeforces Round #170 Div. 1】 227A Learning Languages
- 避免 C/C++ 程序一闪而过的方法
- Python学习梳理
- android应用开发全程实录-你有多熟悉listview?
- C++对C的扩展
- uva1637 Double Patience
- C$PU
- 一些面试问题
- C++的初始化顺序
- phpstorm 2016.2.1最新版本离线激活方法
- (剑指offer)链表