a data structure with key as a cluster of words and value as a single word or string

前端 未结 1 868
遇见更好的自我
遇见更好的自我 2021-01-29 06:11

I want to create a data structure that is able to map a cluster or group of words to a single word or string , it can be thought as of a reverse of what a dictionary does in pyt

1条回答
  •  无人及你
    2021-01-29 07:04

    You can use a regular dict:

    targetword = "good"
    wordmap = {
        "best": targetword,
        "positive": targetword,
        "awesome": targetword,
        "fantastic": targetword
    }
    

    0 讨论(0)
提交回复
热议问题