Retreiving a single number from a list of numbers ?

Peter Moscatt pmoscatt at bigpond.net.au
Thu Jul 19 05:23:43 EDT 2001


Hi Alex,

Great.... just what I wanted.

I have being trying thinks like a(1) instead of using [] and was wondering 
why I was getting errors  :-)

Thanks again Alex.

Pete


Alex K wrote:

> Peter Moscatt wrote:
>> 
>> I am trying to extract a value from a variable that contains more than
>> one value.
>> 
>> For example:
>>     If  I assigned the result of wxGetClientDisplayRect() to the var 'a'
>> like:
>>         a = wxGetClientDisplayRect()
>> 
>> the 'a' would return something like (0, 0, 800. 540)
>> 
>> How then would I assign the 800 from 'a' and give it to a var called 'b'
>> ??
>> 
>> Regards
>> Pete
> 
>>>> a=(0, 0, 800, 540)
>>>> a
> (0, 0, 800, 540)
>>>> a[2]                     <-- slicing
> 800
>>>> (0, 0, 800, 540)[0]
> 0
>>>> (0, 0, 800, 540)[3]
> 540
>>>>
> 




More information about the Python-list mailing list