나는 dict 값에 특정 키에 [Complted]
이 들어 있는지 확인해야하는 간단한 조건이 있습니다.dict 값에 단어/문자열이 포함되어 있는지 확인하는 방법은 무엇입니까?
예를 :
나는Description
키를 시작으로 그 안에
[Complted]
포함 된 경우 확인해야
'Events': [
{
'Code': 'instance-reboot'|'system-reboot'|'system-maintenance'|'instance-retirement'|'instance-stop',
'Description': 'string',
'NotBefore': datetime(2015, 1, 1),
'NotAfter': datetime(2015, 1, 1)
},
],
. 즉
'Descripton': '[완료] 인스턴스가 저하 하드웨어에서 실행되는'내가 그렇게 할 수있는 방법
?
if inst ['Events'][0]['Code'] == "instance-stop":
if inst ['Events'][0]['Description'] consists '[Completed]":
print "Nothing to do here"
이 줄 어떻게해야 무엇 :
은이 방법을 시도? '코드': '인스턴스 재부팅'| '시스템 재부팅'| '시스템 유지 관리'| '인스턴스 중지'| '인스턴스 중지' – sidney
잠재적 인 복제본을 왜 downvote합니까? 그는 충분한 세부 사항을 가지고 질문을하기에 충분히주의를 기울였습니다. –
@HarshTrivedi 아마도 "이 질문은 연구 노력을 보이지 않습니다 ..."* 때문에? – SiHa