Sean Sean - 6 months ago 35
Python Question

In Python, how to get the value of the n-th item in a list?

I am new to python and don't know how to get the n-th item in a list.
In VB.net, item=list(n) gets the n-th item in the array "list", but how do you do it in python?

Thanks!

Answer Source

Consider this code

List = [1,2,3,4] print List[2] To find 3rd element ,n = 2 ,(3 - 1) This is becuase of zero indexing in python