I am using collections.defaultdict(list).
My print looks like the following:
{ 'A': [{'UNP': 'P01899'}],
'C': [{'PDB': '2VE6'}],
'B': [{'PDB': '2VE6'}, {'UNP': 'P01887'}],
'E': [{'PDB': '2VE6'}, {'UNP': 'P01887'}],
'D': [{'UNP': 'P01899'}],
'G': [{'UNP': 'P01899'}],
'F': [{'PDB': '2VE6'}],
'I': [{'PDB': '2VE6'}],
'H': [{'PDB': '2VE6'}, {'UNP': 'P01887'}],
'K': [{'PDB': '2VE6'}, {'UNP': 'P01887'}],
'J': [{'UNP': 'P01899'}],
'L': [{'PDB': '2VE6'}] }
What I want to do is use a clause if 'UNP' do something, if only 'PDB' and no 'UNP' then do something different.
I am very new to scripting. so any help is highly appreciated. thanks
'UNP'where? In the whole outer dict?defaultdictor not. In any case you need to give an example of what you want to do, with code or at least pseudocode.collections.defaultdict(list)? Do you want an empty list to be the default value for dictionary entries that are not set explicitly?