if os.path.getsize(filename1) == os.path.getsize(filename2):
    if open('filename1', 'r').read() == open('filename2', 'r').read():
        pass
In Python, is there a concise way of comparing whether the contents of two text files are the same?