i have dictionary
myd = {
'Items': [{'key':2}
],
'Count': 1,
'RetryAttempts': 0
}
I m printing the key with below
print(myd['Items'][0].get('key'))
I have dictionary which 'Items' is empty
myd = {
'Items': [
],
'Count': 0,
'RetryAttempts': 0
}
If I try with print(a['Items'][0].get('key'))
I m getting index out of range error
Is there any i can do in list comprehension, if key is not present then need to get empty string
or None