Sean Sean - 1 year ago 71
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, item=list(n) gets the n-th item in the array "list", but how do you do it in python?


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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download