Python 基础[01]
来源:互联网 发布:access数据库考试重点 编辑:程序博客网 时间:2024/05/16 08:36
“编程语言包括语法和标准库。语法相当于武术招式,而标准库实践经验则类似于内功,需要长期锻炼。Python学习了Java的长处,提供了大量极方便易用的标准库供程序员"拿来主义"。”
[darkni] 这句话不能说 100% 正确,但是对于任何一门编程语言,入门阶段学习语法,然后一段很长的时间内在标准库的寻找、使用上摸打滚爬。内功依旧是数据结构和算法。
(1)Python 的数组地址从 0 开始计数。范围表示左边是闭区间,右边是开区间。
示例:arr = range(10)
结果:
访问 arr[0] 得到 0 ;访问 arr[1:5] 得到 1,2,3,4
(2)排序和文件操作
排序和文件操作在Coding 时是非常普遍的,记录两篇详细的博客地址:
Python 排序
http://huaxia524151.iteye.com/blog/1169779
Python文件操作读写文件
http://maincoolbo.iteye.com/blog/626655
(3)Slice 切片
seq = [7, 2, 3, 7, 5, 6, 0, 1]
seq[1:5]
[2, 3, 7, 5]
While element at the start index is included, the stop index is not included, so that the number of elements in the result is stop - start.
Either the start or stop can be omitted in which case they default to the start of the sequence and the end of the sequence.
seq[:5] 从 [0,5) 的切片
seq[3:] 从 [3,end) 的切片
seq[-4:] 从倒数第四个到 end
seq[-6:-2] (共四个元素,-6, -5, -4, -3)
(4)数据结构
[待续...]
- python基础01-数据类型
- Python 基础[01]
- Python 基础01
- Python基础 01
- Python基础01-04
- python基础学习01
- Python 基础练习01
- Python之基础01
- python基础-01
- Python基础01
- 01Python基础语法
- Python语言基础-01
- python基础入门 01
- Python基础:01Python标准类型分类
- python数据挖掘01--python基础
- Python基础01 Hello World!
- Python基础01 Hello World!
- Python基础01 Hello World!
- 图像的部分截取
- ASP.NET MVC 入门6、TempData
- QQ使用的一个小问题
- 添加底图模糊效果
- awk与正则表达式
- Python 基础[01]
- Can't find API database; API check not performed
- ASP.NET MVC 入门7、Hellper与数据的提交与绑定
- CSS控制文本超出指定宽度后用省略号代替,CSS控制文本不换行
- [ios]关于error:Cannot assign to 'self' outside of a method in the init family
- 在excel中用vb做简单的数据帅选
- “CFW&辛巴达”杯女装(欣赏篇)
- bios
- UIScrollView 原理详解