파이썬 3.6에서 두 개의 사전 목록을 정렬하고 비교하는 방법을 찾으려고합니다. 나는 궁극적으로 list_dict_a
과 list_dict_b
을 ==
과 비교하고 True
으로 평가하고 싶습니다. 여기Dicts Python 목록 정렬 및 비교
처럼 데이터가 모습입니다 :
list_dict_a = [
{'expiration_date': None, 'identifier_country': None, 'identifier_number': 'Male', 'identifier_type': 'Gender', 'issue_date': None},
{'expiration_date': None, 'identifier_country': 'VE', 'identifier_number': '1234567', 'identifier_type': 'Foo No.', 'issue_date': None}]
list_dict_b = [
{'identifier_country': 'VE', 'expiration_date': None, 'identifier_type': 'Foo No.', 'issue_date': None, 'identifier_number': '1234567'},
{'identifier_country': None, 'expiration_date': None, 'identifier_type': 'Gender', 'issue_date': None, 'identifier_number': 'Male'}]
데이터는 동일하지만 서로 다른 주문 (필자는 초기 주문에 대한 제어를 필요 없다)에 제공됩니다. print("does this match anything",list_dict_a == list_dict_b)
이도 가능 할 수 있습니다 : 다음과 같은 일을 할 때
나는 그런 그들을 비교하려고
, 나는 거짓 값을 얻을?
https://stackoverflow.com/questions/9845369/comparing-2-lists-consisting-of-dictionaries-with-unique-keys-in-python –