I want to extract string “GROUP” from 2 level encapsulated dictionary.
dict = {'instance1' : {'runType' : 'GROUP'},
'instance2' : { 'runType' : 'PROCESS'}}
If i access runType of instance1 with obviuos way dict['instance1']['runType'], then i get the string ['GROUP']. I also tried dict['instance1'].get('runType', 'Null'), with hope that .get will return raw string "GROUP", but that did not happened.
Is there any other short way to get pure string data from X>1 level of dictionary without str() and then strip() etc.?
————–Solution—————
dict[‘instance1’][‘runType’][0] will return pure GROUP string
Just got correct answer from friend. [‘GROUP’] is a list with 1 member.
So , dict[‘instance1’][‘runType’][0] will return pure GROUP.
Thank you everybody!