Challenge 1
Compare the two files by their contents.
import filecmp
from pathlib import Path
from tempfile import TemporaryDirectory
with TemporaryDirectory() as temporary:
root = Path(temporary)
first = root / "first.txt"
second = root / "second.txt"
first.write_text("report", encoding="utf-8")
second.write_text("report", encoding="utf-8")
same = filecmp.cmp(first, second, )
assert same is True
print(same)
Press Ctrl⌘Enter to check your answer