Discuss / Python / 求解,如果在list里面插入多个dict,怎么依次读取呢?

求解,如果在list里面插入多个dict,怎么依次读取呢?

比如说,

test1 = {'1'='2'}

test2 = [test1]

如果我用test2(0)去试图读取test1,就会报错

TypeError: 'list' object is not callable

求解我要如何去读取这个test1呢?

chaif87

#2 Created at ... [Delete] [Delete and Lock User]

注意是[],不是(),()是函数调用了~

>>> test1 = {'1':'2'}
>>> test2 = [test1]
>>> test2[0]
{'1': '2'}

  • 1

Reply