Search for mapping solution
Markus Joschko
jocsch at phreaker.net
Sun Jul 6 16:00:59 EDT 2003
>
> Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> lines = [['fred','333','0,10'],['sam','444','1'],['fred','333','0,50']]
>>>> d = dict([(x[0], x[2]) for x in lines])
>>>> d
> {'sam': '1', 'fred': '0,50'}
fred should be 0,60. The 3rd column should be summarized.
>
> OK, I'll write and maintain a 1000-line perl program as penance ...
>
> sometimes-concise-is-elegant-too-ly yrs.
>
More information about the Python-list
mailing list