group1= [ {
'Name': 'C21114',
'Description': '',
'num': '12321114',
'working': 'true',
'belongs': 'Default',
'Expiry_Date': '',
'\xef\xbb\xbfUser_ID': 'C21114',
'Password': '*SECRET*',
},
{
'Name': 'Mahes',
'Description': '',
'num': '1026',
'working': 'true',
'belongs': 'Default',
'Expiry_Date': '',
'\xef\xbb\xbfUser_ID': 'Mahi',
'Password': '*SECRET*',
},
{
'Name': 'pri',
'Description': '',
'num': '1027',
'working': 'true',
'belongs': 'Default',
'Expiry_Date': '',
'\xef\xbb\xbfUser_ID': 'priya',
'Password': '*SECRET*',
}]
group2= [{
'Name': 'C21114',
'Description': '',
'num': '12321114',
'working': 'true',
'belongs': 'Default',
'Expiry_Date': '',
'User_ID': 'C21114',
'Password': '*SECRET*',
},
{
'Name': 'Mahes',
'Description': '',
'num': '1026',
'working': 'true',
'belongs': 'Default',
'Expiry_Date': '',
'User_ID': 'Mahi',
'Password': '*SECRET*',
},
{
'Name': 'pri',
'Description': '',
'num': '1027',
'working': 'true',
'belongs': 'Default',
'Expiry_Date': '',
'User_ID': 'priya',
'Password': '*SECRET*',
}]
需要比较group1和group2的几个键是否相同。 group1和group2在很多词典中都有列出。我只需要比较几个键与其在group1和group2之间的值。用一个例子说明。例子:来自group1和group2的keys_to_compare = {'name','num',working}。使用列表中的键共同映射两个字典值
欢迎来到StackOverflow。您发布的帖子很有可能会获得更多回复,如果您发布您的尝试 – inspectorG4dget