Skip to content

Instantly share code, notes, and snippets.

@drpshtiwan
Created August 5, 2023 00:45
Show Gist options
  • Save drpshtiwan/8eda4f58ede5191f5c59b74fd0199454 to your computer and use it in GitHub Desktop.
Save drpshtiwan/8eda4f58ede5191f5c59b74fd0199454 to your computer and use it in GitHub Desktop.
diff between tow dict list in python
old = [
{
"type": 19,
"position": 0,
"time": 45
},
{
"type": 1,
"position": 1,
"time": 47,
"player_id": "3glrw7hl0g8qdyj",
"player_name": "Hussein El Shahat",
"assist1_id": "965mkyhe4p41r1g",
"assist1_name": "Ahmed Mohamed Abdel Kader Radwan",
"home_score": 1,
"away_score": 0
},
{
"type": 11,
"position": 0,
"time": 48
},
{
"type": 9,
"position": 2,
"time": 55,
"in_player_id": "6ypq3nhw94o9md7",
"in_player_name": "William Gillion",
"out_player_id": "dj2ryohy8epq1zp",
"out_player_name": "Emiliano Tade",
"reason_type": 4
},
{
"type": 1,
"position": 1,
"time": 56,
"player_id": "y0or5jhjlljqwzv",
"player_name": "Mohamed Sherif",
"home_score": 2,
"away_score": 0
},
{
"type": 9,
"position": 2,
"time": 71,
"in_player_id": "dn1m1gh3ew54moe",
"in_player_name": "Jordan Vale",
"out_player_id": "vjxm8ghjejxkr6o",
"out_player_name": "Nathan Lobo",
"reason_type": 4
},
{
"type": 9,
"position": 2,
"time": 71,
"in_player_id": "1l4rjnhx1ww0m7v",
"in_player_name": "Angus John Dennison Kilkolly",
"out_player_id": "n54qllhxgnvqvy9",
"out_player_name": "Ryan De Vries",
"reason_type": 4
},
{
"type": 9,
"position": 1,
"time": 75,
"in_player_id": "965mkyhzol5r1ge",
"in_player_name": "Percy Tau",
"out_player_id": "965mkyhe4p41r1g",
"out_player_name": "Ahmed Mohamed Abdel Kader Radwan",
"reason_type": 4
},
{
"type": 9,
"position": 1,
"time": 75,
"in_player_id": "k82rekh19o9repz",
"in_player_name": "Taher Mohamed",
"out_player_id": "3glrw7hl0g8qdyj",
"out_player_name": "Hussein El Shahat",
"reason_type": 4
},
{
"type": 9,
"position": 2,
"time": 78,
"in_player_id": "ednm9whv9j22ryo",
"in_player_name": "Reid Drake",
"out_player_id": "23xmvkhkonnlqg8",
"out_player_name": "Gerard Garriga Gibert",
"reason_type": 4
},
{
"type": 9,
"position": 2,
"time": 78,
"in_player_id": "2y8m4zh8evg4ql0",
"in_player_name": "Joseph Lee",
"out_player_id": "l7oqdeh065vlr51",
"out_player_name": "Dylan Manickum",
"reason_type": 4
},
{
"type": 9,
"position": 1,
"time": 80,
"in_player_id": "l5ergphv4674r8k",
"in_player_name": "Marwan Attia",
"out_player_id": "n54qllh9284qvy9",
"out_player_name": "Hamdi Fathi",
"reason_type": 4
},
{
"type": 9,
"position": 1,
"time": 80,
"in_player_id": "965mkyh381pr1ge",
"in_player_name": "Kahraba",
"out_player_id": "y0or5jhjlljqwzv",
"out_player_name": "Mohamed Sherif",
"reason_type": 4
},
{
"type": 9,
"position": 1,
"time": 83,
"in_player_id": "23xmvkhw3k2qg8n",
"in_player_name": "Mohamed Magdy Afsha",
"out_player_id": "2y8m4zh4wvzql07",
"out_player_name": "Amr Al Sulaya",
"reason_type": 4
},
{
"type": 1,
"position": 1,
"time": 86,
"player_id": "965mkyhzol5r1ge",
"player_name": "Percy Tau",
"assist1_id": "965mkyh381pr1ge",
"assist1_name": "Kahraba",
"home_score": 3,
"away_score": 0
},
{
"type": 19,
"position": 0,
"time": 90
},
{
"type": 28,
"position": 2,
"time": 95,
"player_id": "jw2r09hjnoejrz8",
"player_name": "Adam Thomas Mitchell",
"var_reason": 6,
"var_result": 7
},
{
"type": 28,
"position": 1,
"time": 97,
"player_id": "k82rekh19o9repz",
"player_name": "Taher Mohamed",
"var_reason": 3,
"var_result": 4
},
]
new = [
{
"type": 19,
"position": 0,
"time": 45
},
{
"type": 1,
"position": 1,
"time": 47,
"player_id": "3glrw7hl0g8qdyj",
"player_name": "Hussein El Shahat",
"assist1_id": "965mkyhe4p41r1g",
"assist1_name": "Ahmed Mohamed Abdel Kader Radwan",
"home_score": 1,
"away_score": 0
},
{
"type": 11,
"position": 0,
"time": 48
},
{
"type": 9,
"position": 2,
"time": 55,
"in_player_id": "6ypq3nhw94o9md7",
"in_player_name": "William Gillion",
"out_player_id": "dj2ryohy8epq1zp",
"out_player_name": "Emiliano Tade",
"reason_type": 4
},
{
"type": 1,
"position": 1,
"time": 56,
"player_id": "y0or5jhjlljqwzv",
"player_name": "Mohamed Sherif",
"home_score": 2,
"away_score": 0
},
{
"type": 9,
"position": 2,
"time": 71,
"in_player_id": "dn1m1gh3ew54moe",
"in_player_name": "Jordan Vale",
"out_player_id": "vjxm8ghjejxkr6o",
"out_player_name": "Nathan Lobo",
"reason_type": 4
},
{
"type": 9,
"position": 2,
"time": 71,
"in_player_id": "1l4rjnhx1ww0m7v",
"in_player_name": "Angus John Dennison Kilkolly",
"out_player_id": "n54qllhxgnvqvy9",
"out_player_name": "Ryan De Vries",
"reason_type": 4
},
{
"type": 9,
"position": 1,
"time": 75,
"in_player_id": "965mkyhzol5r1ge",
"in_player_name": "Percy Tau",
"out_player_id": "965mkyhe4p41r1g",
"out_player_name": "Ahmed Mohamed Abdel Kader Radwan",
"reason_type": 4
},
{
"type": 9,
"position": 1,
"time": 75,
"in_player_id": "k82rekh19o9repz",
"in_player_name": "Taher Mohamed",
"out_player_id": "3glrw7hl0g8qdyj",
"out_player_name": "Hussein El Shahat",
"reason_type": 4
},
{
"type": 9,
"position": 2,
"time": 78,
"in_player_id": "ednm9whv9j22ryo",
"in_player_name": "Reid Drake",
"out_player_id": "23xmvkhkonnlqg8",
"out_player_name": "Gerard Garriga Gibert",
"reason_type": 4
},
{
"type": 9,
"position": 2,
"time": 78,
"in_player_id": "2y8m4zh8evg4ql0",
"in_player_name": "Joseph Lee",
"out_player_id": "l7oqdeh065vlr51",
"out_player_name": "Dylan Manickum",
"reason_type": 4
},
{
"type": 9,
"position": 1,
"time": 80,
"in_player_id": "l5ergphv4674r8k",
"in_player_name": "Marwan Attia",
"out_player_id": "n54qllh9284qvy9",
"out_player_name": "Hamdi Fathi",
"reason_type": 4
},
{
"type": 9,
"position": 1,
"time": 80,
"in_player_id": "965mkyh381pr1ge",
"in_player_name": "Kahraba",
"out_player_id": "y0or5jhjlljqwzv",
"out_player_name": "Mohamed Sherif",
"reason_type": 4
},
{
"type": 9,
"position": 1,
"time": 83,
"in_player_id": "23xmvkhw3k2qg8n",
"in_player_name": "Mohamed Magdy Afsha",
"out_player_id": "2y8m4zh4wvzql07",
"out_player_name": "Amr Al Sulaya",
"reason_type": 4
},
{
"type": 1,
"position": 1,
"time": 86,
"player_id": "965mkyhzol5r1ge",
"player_name": "Percy Tau",
"assist1_id": "965mkyh381pr1ge",
"assist1_name": "Kahraba",
"home_score": 3,
"away_score": 0
},
{
"type": 19,
"position": 0,
"time": 90
},
{
"type": 28,
"position": 2,
"time": 95,
"player_id": "jw2r09hjnoejrz8",
"player_name": "Adam Thomas Mitchell",
"var_reason": 6,
"var_result": 7
},
{
"type": 28,
"position": 1,
"time": 97,
"player_id": "k82rekh19o9repz",
"player_name": "Taher Mohamed",
"var_reason": 3,
"var_result": 4
},
{
"type": 4,
"position": 2,
"time": 97,
"player_id": "jw2r09hjnoejrz8",
"player_name": "Adam Thomas Mitchell",
"reason_type": 13
},
{
"type": 12,
"position": 0,
"time": 98
}
]
difference = [x for x in new if x not in old]
print(difference)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment