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

A list is a sequence的更多相关文章

  1. oracle SEQUENCE 创建, 修改,删除

    oracle创建序列化: CREATE SEQUENCE seq_itv_collection            INCREMENT BY 1  -- 每次加几个              STA ...

  2. Oracle数据库自动备份SQL文本:Procedure存储过程,View视图,Function函数,Trigger触发器,Sequence序列号等

    功能:备份存储过程,视图,函数触发器,Sequence序列号等准备工作:--1.创建文件夹 :'E:/OracleBackUp/ProcBack';--文本存放的路径--2.执行:create or ...

  3. DG gap sequence修复一例

    环境:Oracle 11.2.0.4 DG 故障现象: 客户在备库告警日志中发现GAP sequence提示信息: Mon Nov 21 09:53:29 2016 Media Recovery Wa ...

  4. Permutation Sequence

    The set [1,2,3,-,n] contains a total of n! unique permutations. By listing and labeling all of the p ...

  5. [LeetCode] Sequence Reconstruction 序列重建

    Check whether the original sequence org can be uniquely reconstructed from the sequences in seqs. Th ...

  6. [LeetCode] Binary Tree Longest Consecutive Sequence 二叉树最长连续序列

    Given a binary tree, find the length of the longest consecutive sequence path. The path refers to an ...

  7. [LeetCode] Verify Preorder Sequence in Binary Search Tree 验证二叉搜索树的先序序列

    Given an array of numbers, verify whether it is the correct preorder traversal sequence of a binary ...

  8. [LeetCode] Longest Consecutive Sequence 求最长连续序列

    Given an unsorted array of integers, find the length of the longest consecutive elements sequence. F ...

  9. [LeetCode] Permutation Sequence 序列排序

    The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the p ...

  10. Leetcode 60. Permutation Sequence

    The set [1,2,3,-,n] contains a total of n! unique permutations. By listing and labeling all of the p ...

随机推荐

  1. HDU 4165

    一块药看成括号配对就行了.很明显的直接求卡特兰数. 今晚看了HDU 3240的题,有一点思路,但无情的TLE.想不到什么好方法了,看了别人的解答,哇...简直是天才的做法啊....留到星期六自己思考一 ...

  2. Java面试中常问的数据库方面问题

    MySQL 为什么用自增列作为主键 如果我们定义了主键(PRIMARY KEY),那么InnoDB会选择主键作为聚集索引.如果没有显式定义主键,则InnoDB会选择第一个不包含有NULL值的唯一索引作 ...

  3. Hibernate关系映射中的注解

    一.@Entity 写在映射表的类上面,表示这是映射来的实体 二.@Id @Column(name = "fid", nullable = false) @Basic @Colum ...

  4. ORA-01733: virtual column not allowed here

    基表: hr.tt  scott.tt  视图1: 基于 hr.tt  union all  scott.tt ---> scott.ttt  视图2: 基于 视图1->scott.ttt ...

  5. phpstorm 或 webstorm 设置打开多个项目,多个项目并存。

    File -> settings -> Directories -> Add Content Root 中添加你当前的工程目录. 这样就可以节省内存了.之前用一个打开php项目,一个 ...

  6. legend---十、thinkphp中如何进行原生sql操作

    legend---十.thinkphp中如何进行原生sql操作 一.总结 一句话总结:query方法和execute方法 Db类支持原生SQL查询操作,主要包括下面两个方法: query方法 quer ...

  7. 移动端video播放时不弹出页面层

    移动端视频在播放时会主动弹出页面,有的浏览器不会.对那些会的浏览器进行处理: 直接加上下面三个属性即可,兼容方面就不说了,微信上是很ok的. <video x5-playsinline=&quo ...

  8. C# 对象初始化器和集合初始化器

    /// <summary>/// 图书类/// </summary>public class Book {     /// <summary>     /// 图书 ...

  9. vue实现tab栏切换

    html <ul class="tab"> <li v-for="(item,index) in tabs" @click="tab ...

  10. C语言基础 (2) linux命令

    01.课程回顾 链接 ln 1.txt aaa.txt  硬链接 (两个相互独立 删除一个另外一个还在) ln -s 1.txt aaa.txt软连接 (后面的是快捷方式) 硬链接只能是文件,软连接可 ...