Python学习
2.1 列表的定义
定义一个列表用“[]”,其中的内容用“,”分隔。注意,一个列表中的元素可以是多种数据类型,如下:
>>> type([1,2,3,4,5])
<class 'list'>
>>> type(["hello","world",1,9,])
<class 'list'>
>>> ["hello","world",1,9,True,False]
['hello', 'world', 1, 9, True, False]
列表内部可以再嵌套列表,如下(称作嵌套列表):
>>> [[1,2],[3,4],[True,False]]
[[1, 2], [3, 4], [True, False]]
>>> type([[1,2],[3,4],[True,False]])
<class 'list'>