assisging multiple values to a element in dictionary

Vyacheslav Maslov vmaslov at swsoft.com
Mon May 7 07:30:26 EDT 2007


>        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'.
In general dictionary define strong relation between keys and values, 
key should have only one associated value, but in your case value can be 
  a tuple or list.

Anyway, i think that your question contradict to dictionary concept, 
because is impossilbe to assign for some key multiple values.


-- 
Vyacheslav Maslov



More information about the Python-list mailing list