---
title: Python Sequence Types
localeTitle: Python序列类型
---
这些表示由非负数索引的有限有序集。内置函数`len()`返回序列的项数。当序列的长度为`n` ，索引集包含数字`0, 1, ..., n-1` 。序列a的项目`i`由`a<a href='https://docs.python.org/3/reference/datamodel.html#the-standard-type-hierarchy' target='_blank' rel='nofollow'>i]` 。

\[Python文档 - 标准类型层次结构

## 更多

*   内置序列类型是：
    
    *   `list`
        
    *   `tuple`
        
    *   `range`
        
*   内置序列类型是可迭代类型（实现所需的`__iter__()`方法）。
    
*   操作：
    
    *   [常用序列操作](https://docs.python.org/3/library/stdtypes.html#common-sequence-operations)
        
    *   [可变序列类型](https://docs.python.org/3/library/stdtypes.html#mutable-sequence-types)
        
    *   [不可变序列类型](https://docs.python.org/3/library/stdtypes.html#immutable-sequence-types)