A list is a sequence
Like a string, a list is a sequence of values. In a string, the values are characters; in a list, they can be any type. The values in list are called elements or sometimes items. There are several ways to create a new list; the simplest is to enclose the elements in square brackets ( [ ]):
[10, 20, ‘span’, [30,40]]
A list within another list is said to be nested. A list that contains no elements is called an empty list; you can create one with empty brackets, []. List that contain consecutive integers are common, so Python provides a built-in function to create them:
range takes two arguments and returns a list that contains all the integers from the first to the second, including the first but excluding the second! With one argument, range starts at 0:
If there is a third argument, it specifies the space between successive values, which is called the ‘step size’.
from Thinking in Python
最新文章
- sed 命令使用
- SVNServer迁移
- Laravel 安装多国语言包后,phpstorm 还是报错
- Qt之多窗口切换
- git-svn
- SqlServer 事务和异常处理示例
- 1,php概述
- 思科27亿美元收购网络安全公司Sourcefire
- FileZilla简单介绍及运用
- Android应用开发学习笔记之ContentProvider
- SSH整合之_架构的历史序列图
- 【反编译系列】二、反编译代码(jeb)
- iOS开发之HTTP与HTTPS网络请求
- C#学习-图解教程(2):访问修饰符(其中两种)
- Android学习之基础知识四-Activity活动4讲(Intent传递数据)
- 步步深入MySQL:架构->;查询执行流程->;SQL解析顺序!
- 您需要来自XXX的权限才能对此文件夹进行更改
- 10个优秀的jQuery Mobile主题
- 最小费用流spfa算法模板(pascal)
- ROS知识(6)----卸载ROS系统