作者:_妃妃教主 | 来源:互联网 | 2023-09-14 17:58
Ihaveaprogramthatcanaskusertocategorizeandexistingdictionary:hereismydictionary:我有一
I have a program that can ask user to categorize and existing dictionary: here is my dictionary:
我有一个程序,可以要求用户分类和现有字典:这是我的字典:
>>> print Vocab_World
{'excelent': 'awesome', 'quit': 'exit', 'great': 'good', 'ceken':
'bilir', 'tremendous': 'fabolous', 'gurbet': 'hasret', 'postpone':
'put_offt', 'ozlem': 'hasret'}
Now I want to ask the user if they want to categorize the same meaning words as nested dictionary and I want to have a list like below one for the categorized words
现在我想询问用户是否要将与嵌套字典相同的含义词进行分类,并希望对于分类词有一个如下所示的列表
{'Adverb' : {'excelent': 'awesome','great': 'good','tremendous': 'fabolous'} }
.
categorized_words = raw_input("Please select the words that you want to categorize")
new_category = raw_input("Please input the new category name ")
categorized_World=Vocab_World[new_category][0][categorized_words]
Is there a way of doing that dynamically based on user input ?
有没有办法根据用户输入动态执行此操作?
2 个解决方案