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. POJ 3695

    可以用容斥原理来求.求两个矩形的并的时候可以使用条件 x1=max(p.x1,q.x1);y1=max(p.y1,q.y1);x2=min(p.x2,q.x2);y2=min(p.y2,q.y2); ...

  2. Ruby print

    Ruby print

  3. c#将List<T>转换成DataSet

    /// <summary>         /// List<T> 转换成DataSet         /// </summary>         /// &l ...

  4. JDBC-连接数据库代码

    package com.zxc.connection; import java.sql.Connection; import java.sql.DriverManager; public class ...

  5. 【手势交互】9. PS Move

    索尼研发体感控制技术已有10年,在过去那么多年里.尝试了3D摄像头.超声波和电磁感应等各种技术.最后还是觉得眼下的MOVE所使用的技术最为合适.PS Move是索尼于2010年9月份推出.用来让PS3 ...

  6. Matplotlib画图可选颜色

    经常会有画图找不到合适颜色的尴尬情景, 在网上找到一张matplotlib可以用的颜色图:

  7. hexo博客谷歌百度收录踩坑日记

    title: hexo博客谷歌百度收录踩坑日记 toc: false date: 2018-04-17 00:09:38 百度收录文件验证 无论怎么把渲染关掉或者render_skip都说我的格式错误 ...

  8. POJ 3044单调栈

    题意: 思路: 单调栈 // by SiriusRen #include <stack> #include <cstdio> using namespace std; stac ...

  9. 51nod 1785 数据流中的算法 (方差计算公式)

    1785 数据流中的算法 基准时间限制:1.5 秒 空间限制:131072 KB 分值: 20 难度:3级算法题   51nod近日上线了用户满意度检测工具,使用高级人工智能算法,通过用户访问时间.鼠 ...

  10. HDU 3015 Disharmony Trees 【 树状数组 】

    题意:给出n棵树,给出横坐标x,还有它们的高度h,先按照横坐标排序,则它们的横坐标记为xx, 再按照它们的高度排序,记为hh 两颗树的差异度为 abs(xx[i] - xx[j]) * min(hh[ ...