[SciPy-User] [SciPy-user] How to get access to Array elements

suzana8447 k-assem84 at hotmail.com
Fri May 13 08:33:45 EDT 2011


Thanks very much

Keith Goodman wrote:
> 
> On Thu, May 5, 2011 at 7:50 AM, suzana8447 <k-assem84 at hotmail.com> wrote:
> 
>> array([1,2,8,10,50)]
>> note that the third element in the array is 8.  I want to form an if
>> statement as this:
>> if(x==8): print x # just as an example.
>> But how to declare x as the third elemnt of the above array.
> 
> Here's an example:
> 
>     >> import numpy as np
>     >> a = np.array([1,2,8,10,50])
>     >> a[0]
>        1
>     >> a[1]
>        2
>     >> a[2]
>        8
>     >> a[3]
>        10
>     >> a[4]
>        50
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-get-access-to-Array-elements-tp31551042p31610990.html
Sent from the Scipy-User mailing list archive at Nabble.com.




More information about the SciPy-User mailing list