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

最新文章

  1. sed 命令使用
  2. SVNServer迁移
  3. Laravel 安装多国语言包后,phpstorm 还是报错
  4. Qt之多窗口切换
  5. git-svn
  6. SqlServer 事务和异常处理示例
  7. 1,php概述
  8. 思科27亿美元收购网络安全公司Sourcefire
  9. FileZilla简单介绍及运用
  10. Android应用开发学习笔记之ContentProvider
  11. SSH整合之_架构的历史序列图
  12. 【反编译系列】二、反编译代码(jeb)
  13. iOS开发之HTTP与HTTPS网络请求
  14. C#学习-图解教程(2):访问修饰符(其中两种)
  15. Android学习之基础知识四-Activity活动4讲(Intent传递数据)
  16. 步步深入MySQL:架构->查询执行流程->SQL解析顺序!
  17. 您需要来自XXX的权限才能对此文件夹进行更改
  18. 10个优秀的jQuery Mobile主题
  19. 最小费用流spfa算法模板(pascal)
  20. ROS知识(6)----卸载ROS系统

热门文章

  1. oracle学习之第一个存储过程:打印Hello World
  2. yqj2065经典语录
  3. CoreData(数据库升级 )版本迁移-iOS App升级安装
  4. 极客时间 mysql实战45讲下载读 08讲事务到底是隔离的还是不隔离的 笔记
  5. OUTLOOK网站直接点击发送邮件
  6. CSS3中的transition
  7. 影像服务——加载CESIUM自带的影像服务
  8. C实现JAVA类似ArrayList的静态链接库
  9. 纯净版linux (debian)挂载VirtualBox共享文件夹
  10. react添加右键点击事件