我有两个列表,如下所示:
并且。
任何帮助和建议都受欢迎!
found = ['CG', 'E6', 'E1', 'E2', 'E4', 'L2', 'E7', 'E5', 'L1', 'E2BS', 'E2BS', 'E2BS', 'E2', 'E1^E4', 'E5']
expected = ['E1', 'E2', 'E4', 'E1^E4', 'E6', 'E7', 'L1', 'L2', 'CG', 'E2BS', 'E3']
我希望找出这两个列表之间的不同处。
我已经完成了
list(set(expected)-set(found))
并且。
list(set(found)-set(expected))
这将分别返回['E3']
和['E5']
。
然而,我所需的答案是:
'E3' is missing from found.
'E5' is missing from expected.
There are 2 copies of 'E5' in found.
There are 3 copies of 'E2BS' in found.
There are 2 copies of 'E2' in found.
任何帮助和建议都受欢迎!