Python :数据结构
LearnPython :数据结构 Python 数据结构基础¶ Ref: link My questions: dictionary -- 字典 : array -- 数组 list -- 列表 sequence -- 序列? 元组 -- tuple 1. dictionary¶ In [ ]: 2. sequence¶ Python有6个序列的内置类型,但最常见的是列表和元组。 Sequence Types -- str, unicode, list, tuple, buffer, xrange ref 序列都可以进行的操作包括*索引,切片,加,乘,检查成员 Python已经内置确定序列的长度以及确定最大和最小的元素的方法 2.1 list 列表¶ 列表是最常用的Python数据类型,它可以作为一个方括号内的逗号分隔值出现。 列表的数据项不需要具有相同的类型. 例如: In [2]: #!/usr/bin/python3 list1 = [‘Google’, ‘Runoob’, 1997, 2000]; list2 = [1, 2, 3, 4, 5, 6, 7 ]; print (“list1[0]: “, list1[0]) print (“list2[1:5]: “, list2[1:5]) list1[0]: Google list2[1:5]: [2, 3, 4, 5] 2.
…