初识Python
来源:互联网 发布:php 将文件压缩成zip 编辑:程序博客网 时间:2024/06/05 17:31
趁闲暇之余研究一下当前比较火热的Python语言。
安装了Python3.4,然后在IDLE写了第一个Python程序,后来去网上查了一下,eclipse和VS都可以写Python,最后都试了一下,觉得还是在eclipse写比较舒服。为此,我又去下了一个eclipse,专门写Python,现在电脑里已经有4个了。。。
'''Created on 2014年6月10日@author: zx'''from builtins import len#变量没有类型,列表和数组类似movie=["a",1,"b",2,"c",3]print(movie)print(len(movie))print(movie[2])#增删 插入操作,说明列表是动态的movie.append("4")print(movie)movie.pop()print(movie)movie.extend(["d",5])print(movie)movie.remove(2)print(movie)movie.insert(2,"e")print(movie) #遍历for each_movie in movie: print(each_movie) #列表能存储列表movies=[1,2,"a",movie,[3,4,[5,6]]]print(movies)print(movies[3][1])print(movies[4][2][1]) #处理多层嵌套列表for each_movie in movies: if isinstance(each_movie, list): for nested_movie in each_movie: if isinstance(nested_movie, list): for deeper_movie in nested_movie: print(deeper_movie) else: print(nested_movie) else: print(each_movie) #用函数优化def print_movie(the_list): for each_item in the_list: if isinstance(each_item, list): print_movie(each_item) else: print(each_item) print_movie(movies)
0 0
- 初识python
- 初识Python
- 初识python
- 初识PYTHON
- 初识Python
- 初识Python
- 初识Python
- Python -- 初识
- 初识Python
- 初识Python
- Python初识
- 初识python
- 初识python
- 初识Python
- python初识
- 初识Python
- 初识Python
- 初识Python
- 在控制台应用程序中如何使用CString 和MessageBox
- python监控linux性能以及进程消耗的性能
- 获取一个目录下的名称符合要求的全部文件+目录
- UImapkit寻找我的位置demo
- Direct2D的使用(1)
- 初识Python
- USB CDC通信设备子类概述
- 图像增强
- java用正则表达式匹配或替换反斜杠(\)的问题
- 程序员永远的痛之字符编码的奥秘
- 更新换代是这个时代的主题,HTML5不是终点
- oj 输入 输出保护继承
- UML作图-类图
- 新建一个serlvet