On Mon, 2007-05-07 at 04:03 -0700, [EMAIL PROTECTED] wrote: > Hi, > I have a dictionary which is something like this: > id_lookup={ > 16:'subfunction', > 26:'dataId', > 34:'parameterId', > 39:'subfunction', > 44:'dataPackageId', > 45:'parameterId', > 54:'subfunction', > 59:'dataId', > 165:'subfunction', > 169:'subfunction', > 170:'dataPackageId', > 174:'controlParameterId' > } > How do i assign multiple values to the key here.Like i want the > key 170 to take either the name 'dataPackageID' or the name > 'LocalId'.I use this in my code,and hence if either comes it should > work .
That sounds to me like you're translating names to numbers. If that is true, you're much better off turning your dictionary around, making the name the key and the corresponding number the value. That way you'll have two keys pointing to the same value, which is perfectly legal, whereas having one key pointing to two values is not really possible. You could have one key pointing to a list or tuple of two values, but it's not obvious whether that would solve your problem. Hope this helps, -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list