Comparing files in Python
Python tip:
You can check if two files are equal with
cmp
from thefilecmp
module. It returnsTrue
if the files are equal andFalse
if they're not.For example:
import filecmp print(filecmp.cmp("file.pdf", "file.pdf")) # => True print(filecmp.cmp("file.pdf", "file1.pdf")) # => False