{ '0':'c->c->a' ,'1':'a->b->a' .........}

chris ozric at web.de
Sun Nov 7 15:24:20 EST 2010


Hi,

have anybody a hint , how i get a dict from non unique id's and their
different related values.

Thanks for advance
Chris

###random data #
a=range(10)*3
def seqelem():
    i=random.randint(0,2)
    elem=['a','b','c'][i]
    return elem

s=[seqelem() for t in  range(30)]
print zip(a,s)

## favored result:
{ '0':'c->c->a' ,'1':'a->b->a' .........}




More information about the Python-list mailing list