array matching

cjw cjw at ncf.ca
Thu Apr 29 17:17:30 EDT 2010


On 29-Apr-10 14:46 PM, MRAB wrote:
> Bill Jordan wrote:
>> Hey guys,
>>
>> I am sorry if this is not the right list to post some questions. I
>> have a simple question please and would appreciate some answers as I
>> am new to Python.
>>
>> I have 2 D array: test = [[A,1],[B,2],[A,3][B,4]]
>> I want to arrang this array in different arrays so each one will have
>> what is attached to. For example I want the output:
>>
>> A =[1,3] and B=[2,4]
>>
> Build a dict of lists, ie the key is the first member of the sublist and
> the value is a list of second members of the sublist.

You might consider numpy, which is designed for arrays.

Colin W.



More information about the Python-list mailing list