数据结构:通过某种方式将数据元素组织在一起,这个数据元素集合称为数据结构。
序列:最基本的数据结构。【0,1,2,···,n-1】或者【-n,···,-3,-2,-1】
列表、···、xrange对象:Python的6种内建序列。
>>>edward = [‘Edward Gumby‘, 42] >>>john = [‘John Smith‘, 40] >>>database = [edward, john] >>>database [[‘Edward Gumby‘, 42], [‘John Smith‘, 40]]
>>>edward[0] ‘Edward Gumby‘ >>>edward[0][0] ‘E‘ >>>edward[0][-1] ‘y‘
>>>numbers = [1, 2, 3, 4, 5] >>>numbers[0] 1 >>>numbers[0:1] [1] >>>numbers[-3:] [3, 4, 5] >>>numbers[:3] [1, 2, 3] >>>numbers[:] [1, 2, 3, 4, 5]
原文:https://www.cnblogs.com/Sakurar/p/11624985.html