movies=["The Holy Grail",1975,"Terry Jones & Terry Gilliam",91,["Graham Chapman",["Michael Palin","John Cleese","Terry Gilliam","Eric Idle","Terry Jones",]]]
print(movies[4][1][3])
最后得到的是Eric Idle,我不太懂的是,书上说["Graham Chapman",是第二个内列表”movies[4]" 这个4是怎么得出来的? 而第三个内列表叫“movies[4][1],这个4和1又是怎么来的? print[4][1][3] 为什么就能输出Eric Idle ?
零基础初学,真的不太懂,求大神赐教!!
Python’s array subscripts start from 0.
The fifth element inmovies[4]
也就是数组movies
:["Graham Chapman",["Michael Palin","John Cleese","Terry Gilliam","Eric Idle","Terry Jones",]]
The fifth element is also a list
[1]
is to take the second element of the fifth element above:["Michael Palin","John Cleese","Terry Gilliam","Eric Idle","Terry Jones",]
This is still a list,
[3]
就是取上面这个数组里的第4个元素:Eric Idle
, is the result.