python 两个字典对比

def commir_two_dict(dictone,dicttwo):
    pass_num=0
    fail_num=0
    try:
        for i in  dictone.keys():
            if i in dicttwo.keys():
                pass_num+=1
            else:
                fail_num+=1
        for j in dictone.values():
            if j in dicttwo.values():
                pass_num+=1
            else:
                fail_num+=1
    except Exception as e:
        fail_num+=1
    if fail_num>0:
        return False
    else:
        return True

 

posted @ 2019-07-20 19:04  北漂的雷子  阅读(429)  评论(0编辑  收藏  举报