Python provides a very convenient way to determine whether the contents of the two files are the same, as long as the two lines of code: >>> Import filecmp >>> filecmp.cmp (r'E: /1.txt' ,r'e: / 2.Txt ') If the two files are the same, TRUE will be output, otherwise false will be output. How is it, very simple?