安装python 3时会自动安装idle(集成开发环境integrated development environment)
python 定义list,直接使用数组的方式 语法如下:
list可以嵌套list,最大限度不能超过1000.
print(ls4[2]) 命令将输出 it's ok ;4 2 1 形同数组偏移量(offset)
for命令循环list元素,语法如下:
循环输入ls变量的内容:
则输出结果为:a 65 b 66 ['c',['d',68,'it's ok]],其中最后一部分作为整体输出。
if语法如下:
如果需要将list中的list元素输出,可以使用if语句
定义函数语法如下:
对于ls变量,包含两层list,如果要将list中的每层list元素单独输出,则需要在2.1.2的循环判断基础上在加一层循环判断,则代码混乱且不易读,可以将list循环输出定义为方法,然后递归调用即可,实现代码如下:
function is a module in python;python 提供了一个中央库(简称pypi)用于管理第三方的模块,和 perl语言的cpan一样。
the python package index (or pypi for short) provides a centralized repository for third-party python modules on the internet. when you are ready, you’ll use pypi to publish your module and make your code available for use by others. and your module is ready, but for one important addition.
给module添加注释(''' 注释内容 '''):