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. Spring boot 使用@Value注入属性

    Spring boot 使用@Value注入属性 学习了:http://blog.csdn.net/hry2015/article/details/72353994 如果启动的时候报错: spring ...

  2. OC的动态继承编译机制

    [问]为什么OC不能sizeof一个对象的大小或一个类的大小?和类结构相近的结构体却能够. [再问]为什么OC不能将对象声明到静态空间,如栈中?和类结构相近的结构体却能够. [答]由于OC的动态继承编 ...

  3. windows编译ffmpeg出现gcc is unable to create an executable file 的普通情况

    近期有个朋友在编译ffmpeg的时候出现这个问题,他非常郁闷. 我就说,为什么我弄的时候就没问题呢??直接./configure +加上后面的參数 安全度过. 然后,我就想了,预计他的gcc的系统变量 ...

  4. h5缓存之数据库

    /*======================================================= 函数功能:保存日志到本地数据库 ========================== ...

  5. crontab任务调度

    基本语法 crontab [选项] 选项: -e:    编辑crontab定时任务 -l:    查询crontab任务 -r:    删除当前用户所有的crontab任务 2)参数说明 [root ...

  6. C#线程调用带参数的方法,给控件赋值

    System.Threading.Thread thread = new System.Threading.Thread(() => { //各种业务 //定义一个委托 public deleg ...

  7. MyBatis数据持久化(一)准备工作

    MyBatis简介 mybatis的前生是ibatis,它是一款非常优秀的java持久层框架,所有sql语句写在配置文件中,和另外一款比较知名的orm框架hibernate比起来显得更加小巧灵活,也是 ...

  8. SQL 中多个 and or 的组合运算

    sql关系型运算符优先级高到低为:not >and> or AND.OR运算符的组合使用 在WHERE子句中,通过AND.OR运算符可以同时连接多个条件,当然AND.OR运算符也可以同时使 ...

  9. Twilio介绍和使用

    1.Twilio是?需要如何才能通过Twilio打国际网络电话 http://uuxn.com/twilio-toll-free-sms介绍了通过网页来收取和发送信息 需求:通过TWILIO拨打国外座 ...

  10. 使用python进行分页操作

    class getPage: """通过这个类 获取 开始和结束点""" def __init__(self,page): try: sel ...