Posted in Python onJuly 03, 2018
如下所示:
>>> 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
以上这篇python 中字典嵌套列表的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持三水点靠木。
python 中字典嵌套列表的方法
- Author -
caoxuemei12声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@