How to compare two 2d lists in python element wise?
问题 I have two 2d lists: Both are of same size with size unknown (different for different set of lists) For instance: A = [['ID', 'Name', 'Profession'], [1, 'Tom', 'Teacher'], [2, 'Dick', 'Actor'], [3, 'Harry', 'Lawyer']] B = [['ID', 'Name', 'Profession'], [1, 'Tom', 'Police'], [2, 'Dick', 'Actor'], [3, 'Harry', 'Lawyer']] I want to compare the files element wise (e.g: a[0][1] == b[0][1] ) for all the elements and print the difference with element index. I would like to have output something like