In Python, is there a concise way of comparing whether the contents of two text files are the same?

后端 未结 8 634
我在风中等你
我在风中等你 2020-11-29 01:51

I don\'t care what the differences are. I just want to know whether the contents are different.

8条回答
  •  天涯浪人
    2020-11-29 02:19

    
    f = open(filename1, "r").read()
    f2 = open(filename2,"r").read()
    print f == f2
    
    
    

提交回复
热议问题