'int' 对象不可订阅,使用元素的元素

'int' object is not subscriptable, using elements of elements

无论我尝试什么,它总是说 'int' 对象不可订阅。有人可以帮助我吗?

    thing1 = ['Thing 1',1,1]
    thing2 = ['Thing 2',2,2]
    thing12 = [thing1,thing2]
    thing3 = thing12[0[0]]
    print(thing3)

这只是我所做的一个例子。我知道我做错了。

您需要更改索引:

thing3 = thing12[0[0]] #wrong, you try to do indexing on 0 which is an integer

将其更改为

#to get thing1 by thing12[0], get the first item of thing12[0] by thing12[0][0]
thing3 = thing12[0][0] 

错误发生是因为 [0[0]] -> 也就是说,您想尝试索引一个 int

'int' object is not subscriptable

我也不是通灵的,不过看来你想改变一下

thing3=thing12[0[0]]

thing3=thing12[0][0]

或类似。