[Tutor] How to extract a value from a matrix.

Steven D'Aprano steve at pearwood.info
Sun May 8 02:50:53 CEST 2011


dlwdan002 at uct.ac.za wrote:
> Hi there
> 
> I am a student and is new to python. I would like to know how to exact a value from a list that has been opened from a text file in python.

Exactly the same way that you would get a value from any other list.

 >>> my_list = [10, 20, 30, 40, 50]
 >>> print my_list[2]  # get a value from the list
30

Don't forget that Python starts counting from 0, not 1.



Does this answer your question? If not, you will need to be more 
specific about what you are trying to do.


-- 
Steven


More information about the Tutor mailing list