时间:2020-12-22 18:00:19 | 栏目:Python代码 | 点击:次
如下所示:
>>> dict={} >>> dict['list']=[] >>> dict['list'].append([1,2,3,4]) >>> dict['list'].append([5,6,7]) >>> dict['list'].append([7,8,9,0,10])
输出字典:
>>> dict {'list': [[1, 2, 3, 4], [5, 6, 7], [7, 8, 9, 0, 10]]} >>> dict['list'] [[1, 2, 3, 4], [5, 6, 7], [7, 8, 9, 0, 10]]
相关操作:
>>> len(dict['list']) 3 >>> dict['list'][1] [5, 6, 7] >>> dict['list'][0][2] 3 >>> len(dict['list'][0]) 4 >>> len(dict['list'][1]) 3