[英]How to have key,key value pair and only keys in python dictionary?
我有一本 python 字典,
P_dic = {'ID': 'STD1'}
我在列表中有與此相對應的 output 。 Lst = ['Len','Lin','lon']
所以基本上對於一個 ID,有三個與之相關的值。
我想要類似的東西,
Result = {'ID': 'STD1'}: {'Len','Lin','lon'}}
我不確定如何將其保存在 python 字典中。 請幫忙。
這可能會幫助您:
P_dict['lst'] = Lst # from Lst variable
或者
P_dict['lst'] = ['Len','Lin','lon'] # direct assignment
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.