I have a dictionary like this which has keys starting with keyword item -
dict1= {'item':1,'a':'a','b':'b','c':'c',
'item-1':2,'d':'d','e':'e',
'item-2':2,'f':'f','g':'g'}
I want to get three dictionaries from the parent dictionary (dict1) as follows-
itemdict={'item':1,'a':'a','b':'b','c':'c'}
item-1dict={'item-1':2,'d':'d','e':'e'}
item-2dict={'item-2':2,'f':'f','g':'g'}
Can someone please help me with the code which can produce the following result?
Oldest comments (0)