Many-to-one mapping (creating equivalence classes)

后端 未结 4 783
花落未央
花落未央 2020-12-31 07:08

I have a project of converting one database to another. One of the original database columns defines the row\'s category. This column should be mapped to a new category in t

4条回答
  •  灰色年华
    2020-12-31 08:04

    If you want to have multiple keys pointing to the same value, i.e.

    m_dictionary{('k1', 'k2', 'k3', 'k4'):1, ('k5', 'k6'):2} and access them as,

    `print(m_dictionary['k1'])` ==> `1`.
    

    Check this multi dictionary python module multi_key_dict. Install and Import it. https://pypi.python.org/pypi/multi_key_dict

提交回复
热议问题