merging in python

Posted by Abruzzo Forte e Gentile on Stack Overflow See other posts from Stack Overflow or by Abruzzo Forte e Gentile
Published on 2010-06-02T19:16:40Z Indexed on 2010/06/02 19:54 UTC
Read the original article Hit count: 148

Filed under:

Hi all

I have the following 4 arrays ( grouped in 2 groups ) that I would like to merge in ascending order by the keys array.

I can use also dictionaries as structure if it is easier.

Has python any command or something to make this quickly possible?

Regards MN

# group 1
[7, 2, 3,  5]  #keys
[10,11,12,26]  #values 

[0,   4]   #keys
[20,  33]  #values 

# I would like to have
[ 0, 2, 3, 4, 5, 7 ] # ordered keys
[20, 11,12,33,26,33] # associated values

© Stack Overflow or respective owner

Related posts about python