diff file1.txt file2.txt

Or if you like color?

git diff file1.txt file2.txt

Pandas

To diff in pandas, see the notebook

Reading/writing files in Python

Reading in one line

content = open("file.txt").read()
print(content)

Writing in one line

content = "Blah blah blah"
open('file.txt', 'w').write(content)

##