I have a simple condition where I need to check if a dict value contains a value [Complted]in a specific key.
example :
'Events': [
{
'Code': 'instance-reboot'|'system-reboot'|'system-maintenance'|'instance-retirement'|'instance-stop',
'Description': 'string',
'NotBefore': datetime(2015, 1, 1),
'NotAfter': datetime(2015, 1, 1)
},
],
I need to check if the key contains Description [Complted]in it at startup. iee
'Descripton': '[Completed] Instance runs on degraded hardware
How can i do this? I'm looking for something like
if inst ['Events'][0]['Code'] == "instance-stop":
if inst ['Events'][0]['Description'] consists '[Completed]":
print "Nothing to do here"
source
share