擅长:python、mysql、java
<p>如果您只想知道它们是否不同,请尝试:</p>
<pre><code>import filecmp
if filecmp.cmp(filename1, filename2, shallow=False):
</code></pre>
<p>来自<a href="https://stackoverflow.com/questions/254350/in-python-is-there-a-concise-way-of-comparing-whether-the-contents-of-two-text">In Python, is there a concise way of comparing whether the contents of two text files are the same?</a></p>