Head First Python——初识Python+列表
来源:互联网 发布:unity3d 材质球shader 编辑:程序博客网 时间:2024/06/05 23:01
Python 是解释型语言
解释型语言就是编译成中间代码程序,在执行时靠翻译程序一起执行,边翻译边执行,当然是靠翻译程序才可以达到跨平台。
编译型就是编译的时候直接编译成机器可以执行的程序,同时也就决定了运行程序所要的平台。
Python 列表
在Python中创建一个列表时,解释器会在内存上创建一个类似数组的数据结构来存储数据,数据项自下而上堆放(形成一个堆栈)。
创建简单的Python列表
>>>movies = ["The Holy Grail","The Life of Brian","The Meaning of Life"]
使用中括号记法访问列表数据
print(movie[1])
print()BIF在屏幕上显示这个列表
len()BIF得出列表中有多少个数据项
列表方法
append() 在列表的末尾添加一个数据项
pop() 从列表末尾删除数据
extend() 在列表末尾添加一个数据项集合
remove() 在列表中找到并删除一个特定的数据项
insert() 在某个特定位置前面增加一个数据项
>>> cast=["Clesse","Palin","Tones","Edle"]>>> cast.append("Gilliam")>>> print(cast)['Clesse', 'Palin', 'Tones', 'Edle', 'Gilliam']>>> cast.pop()'Gilliam'>>> print(cast)['Clesse', 'Palin', 'Tones', 'Edle']>>> cast.extend(["Gilliam","Chapman"])>>> print(cast)['Clesse', 'Palin', 'Tones', 'Edle', 'Gilliam', 'Chapman']>>> cast.remove("Chapman")>>> print(cast)['Clesse', 'Palin', 'Tones', 'Edle', 'Gilliam']>>> cast.insert(0,"Chapman")>>> print(cast)['Chapman', 'Clesse', 'Palin', 'Tones', 'Edle', 'Gilliam']
0 0
- Head First Python——初识Python+列表
- Head first python 之第一章初识python列表学习
- Head First Python第一章:列表
- Head First Python(初识Python)
- Python初入门(一)(Head First Python 第一章 初识Python)
- 《head first python》——web开发
- Head First 设计模式—Python实现
- 《head first python》——理解数据:列表排序与集合
- Head First Python
- Head First Python 读书笔记
- 《head first python》——文件与异常
- 《head first python》——定制数据对象
- 《Head First Python》学习笔记
- Head First Python笔记01
- head first python 读书记录
- head first python /chapter7 web
- Head First Python学习总结
- Head First Python Resource link
- 谈谈如何利用店铺的百度搜索排名获得更多流量
- MapReduce的并行执行效率
- CF414B Mashmokh and ACM 【序列DP】
- 安卓之实现apk的安装
- Hadoop 常用命令
- Head First Python——初识Python+列表
- CSS布局奇淫技巧之-高度自适应
- 配置版MYSQl使用
- pat 1055 how to improve the performance
- 线索二叉树
- 比较函数cmp()
- 美国高手从26美元到创办4家公司的那些事情
- C++类中的static数据成员,static成员函数
- 游戏开发中的一些基本方法